From 01b16012364e5229237683348176c81d1419f444 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 14 May 2025 09:54:44 +0530 Subject: [PATCH 01/13] feat(regional-share): Support for regional file shares --- .../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 | 66 + .../IBM/vpc-go-sdk/common/headers_test.go | 28 + .../IBM/vpc-go-sdk/common/version.go | 4 + common/github.com/IBM/vpc-go-sdk/go.mod | 41 + common/github.com/IBM/vpc-go-sdk/go.sum | 77 + .../IBM/vpc-go-sdk/package-lock.json | 828 + .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 157442 +++++++++++++++ go.mod | 2 + .../data_source_ibm_is_share_mount_target.go | 10 + .../data_source_ibm_is_share_mount_targets.go | 8 + ibm/service/vpc/resource_ibm_is_share.go | 58 +- .../vpc/resource_ibm_is_share_mount_target.go | 36 +- .../d/is_share_mount_target.html.markdown | 3 + .../d/is_share_mount_targets.html.markdown | 1 + website/docs/r/is_share.html.markdown | 1 + .../r/is_share_mount_target.html.markdown | 16 +- 27 files changed, 159307 insertions(+), 11 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..ec4e7f8c0e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -0,0 +1,66 @@ +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_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_REQUEST_ID] = GetNewXRequestID() + + return sdkHeaders +} + +var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return UserAgent +} +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 new file mode 100644 index 0000000000..64f0f82272 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -0,0 +1,28 @@ +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_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..3c8b8f1217 --- /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.44.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..1c1ab5e0a0 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -0,0 +1,41 @@ +module github.com/IBM/vpc-go-sdk + +go 1.21 + +toolchain go1.22.2 + +require ( + 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 + 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 new file mode 100644 index 0000000000..049bc3b5c0 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -0,0 +1,77 @@ +github.com/IBM/go-sdk-core/v5 v5.18.1 h1:wdftQO8xejECTWTKF3FGXyW0McKxxDAopH7MKwA187c= +github.com/IBM/go-sdk-core/v5 v5.18.1/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +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.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.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/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +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= +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/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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +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 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..a2d9e269b6 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -0,0 +1,157442 @@ +/** + * (C) Copyright IBM Corp. 2025. + * + * 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.104.0-b4a47c49-20250418-184351 + */ + +// 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: 2025-04-08 +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 `2025-04-08` + // and `2025-05-02`. + Version *string +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://au-syd.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 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 `2025-04-08` + // and `2025-05-02`. + 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 + } + } + + if options.Version == nil { + options.Version = core.StringPtr("2025-04-22") + } + + service = &VpcV1{ + Service: baseService, + Generation: options.Generation, + Version: options.Version, + } + + if service.Generation == nil { + service.Generation = core.Int64Ptr(2) + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + var endpoints = map[string]string{ + "au-syd": "https://au-syd.iaas.cloud.ibm.com/v1", // Australia (Sydney) + "br-sao": "https://br-sao.iaas.cloud.ibm.com/v1", // Brazil (Sao Paulo) + "ca-mon": "https://ca-mon.iaas.cloud.ibm.com/v1", // Canada (Montreal) + "ca-tor": "https://ca-tor.iaas.cloud.ibm.com/v1", // Canada (Toronto) + "eu-de": "https://eu-de.iaas.cloud.ibm.com/v1", // Germany (Frankfurt) + "eu-es": "https://eu-es.iaas.cloud.ibm.com/v1", // Spain (Madrid) + "eu-gb": "https://eu-gb.iaas.cloud.ibm.com/v1", // United Kingdom (London) + "jp-osa": "https://jp-osa.iaas.cloud.ibm.com/v1", // Japan (Osaka) + "jp-tok": "https://jp-tok.iaas.cloud.ibm.com/v1", // Japan (Tokyo) + "us-east": "https://us-east.iaas.cloud.ibm.com/v1", // US East (Washington DC) + "us-south": "https://us-south.iaas.cloud.ibm.com/v1", // US South (Dallas) + } + + if url, ok := endpoints[region]; ok { + return url, nil + } + return "", core.SDKErrorf(nil, fmt.Sprintf("service URL for region '%s' not found", region), "invalid-region", 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. +// +// The system will automatically create the following additional resources for the VPC: +// - Unless `address_prefix_management` is `manual`, a [default address +// prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for each zone +// - A [default network +// ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl) +// - A [default routing +// table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table) +// - A [default security +// group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group). +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-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 +} + +// 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 *CreateVPCRouteResponse, 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 *CreateVPCRouteResponse, 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, UnmarshalCreateVPCRouteResponse) + 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. +// +// 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, "") + 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, 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. +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 *GetVPCRouteResponse, 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 *GetVPCRouteResponse, 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, UnmarshalGetVPCRouteResponse) + 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 *UpdateVPCRouteResponse, 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 *UpdateVPCRouteResponse, 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, UnmarshalUpdateVPCRouteResponse) + 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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. An image with an `owner_type` of `provider` 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 +// +// An image with an `owner_type` of `provider` 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 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 +} + +// 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 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 +} + +// 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)) + } + if listImagesOptions.UserDataFormat != nil { + builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) + } + if listImagesOptions.OwnerType != nil { + builder.AddQuery("owner_type", fmt.Sprint(*listImagesOptions.OwnerType)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-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 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 +} + +// 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 +// +// An image with an `owner_type` of `provider` 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. An image with an `owner_type` of +// `provider` 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 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)) + } + if listKeysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.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_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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 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 +// 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 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 +} + +// 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 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 +} + +// 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 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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.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)) + } + 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.ReservationAffinityPolicy != nil { + builder.AddQuery("reservation_affinity.policy", fmt.Sprint(*listInstancesOptions.ReservationAffinityPolicy)) + } + 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 +} + +// 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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()) + 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 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 +} + +// 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.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)) + } + 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. 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, "") + 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 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 +} + +// 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 dedicated host groups +// 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, "") + 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 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 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 +} + +// 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 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 + } + 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. 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, "") + 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 + } + + 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 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 +} + +// 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.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)) + } + 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 +} + +// 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 +} + +// 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(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *replaceBareMetalServerInitializationOptions.ID, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range replaceBareMetalServerInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "replace_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 +} + +// RestartBareMetalServer : Restart a bare metal 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, "") + 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 +} + +// 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. +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 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) + 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 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 +} + +// 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.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + 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.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.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_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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 +} + +// 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 an `access_control_mode` of `security_group`, and a +// `replication_role` of `source` or `none`. +// +// The snapshot will inherit its `resource_group` and encryption settings from the share. +// +// 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 +} + +// 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 +} + +// 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}/accessor_bindings/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") + 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_accessor_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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 +} + +// 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 +} + +// 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 +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 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) { + result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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 +} + +// 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 +} + +// 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 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 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 +} + +// 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 +} + +// 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 +} + +// 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 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 +} + +// 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(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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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.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()) + 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) (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) (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(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.AddHeader("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_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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 +} + +// 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 +} + +// 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(createClusterNetworkOptions, "createClusterNetworkOptions") + 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, `/cluster_networks`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createClusterNetworkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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 +} + +// 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 +} + +// 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(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 createClusterNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + 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 + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 createClusterNetworkSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + _, err = builder.SetBodyContentJSON(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + 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 +} + +// 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 +} + +// 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(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, `/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 createClusterNetworkSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.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 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 + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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(deleteClusterNetworkOptions, "deleteClusterNetworkOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *deleteClusterNetworkOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 deleteClusterNetworkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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 + } + + 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, `/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 deleteClusterNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *deleteClusterNetworkSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + 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 deleteClusterNetworkSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_cluster_network_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + 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 +} + +// 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 +} + +// 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(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/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 deleteClusterNetworkSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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(getClusterNetworkOptions, "getClusterNetworkOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getClusterNetworkOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 getClusterNetworkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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_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 +} + +// 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 +} + +// 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(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + 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, `/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 getClusterNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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_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 +} + +// 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 +} + +// 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(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + 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, `/cluster_network/profiles/{name}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getClusterNetworkProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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_cluster_network_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + 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 + } + + 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 { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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, UnmarshalClusterNetworkSubnet) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// 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 +} + +// 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(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/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 getClusterNetworkSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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_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 +} + +// 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 +} + +// 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(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listClusterNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces") + for headerName, headerValue := range 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 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 { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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, UnmarshalClusterNetworkInterfaceCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// 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 +} + +// 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 + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 listClusterNetworkProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles") + for headerName, headerValue := range 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 listClusterNetworkProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start)) + } + if listClusterNetworkProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.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_cluster_network_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfileCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// 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 +} + +// 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, `/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 listClusterNetworkSubnetReservedIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps") + for headerName, headerValue := range 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 listClusterNetworkSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start)) + } + if listClusterNetworkSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit)) + } + 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() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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, UnmarshalClusterNetworkSubnetReservedIPCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// 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 +} + +// 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(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listClusterNetworkSubnetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets") + for headerName, headerValue := range 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 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 { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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, UnmarshalClusterNetworkSubnetCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + 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 + } + + 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, "", "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()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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, UnmarshalClusterNetworkCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// 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 +} + +// 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(updateClusterNetworkOptions, "updateClusterNetworkOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updateClusterNetworkOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 updateClusterNetworkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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(updateClusterNetworkOptions.ClusterNetworkPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 +} + +// 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(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *updateClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *updateClusterNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 updateClusterNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + 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 +} + +// 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 +} + +// 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(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *updateClusterNetworkSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + 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 updateClusterNetworkSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/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(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_cluster_network_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + 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 +} + +// 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 +} + +// 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(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/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 updateClusterNetworkSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "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_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 +} + +// 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 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 +} + +// 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 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) { + 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 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 +} + +// 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 network ACLs +// This request lists network ACLs in the region. A network ACL defines a set of packet filtering rules for traffic in +// and out of the subnets the network ACL is attached to. No traffic is allowed by default. Both allow and deny rules +// can be defined, and rules are stateless so that reverse traffic in response to allowed traffic is not automatically +// allowed. +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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 security groups +// This request lists security groups in the region. A security group defines a set of packet filtering rules to allow +// traffic in and out of the resources targeted by the security group. No traffic is allowed by default. Security group +// rules are stateful so that reverse traffic in response to allowed traffic is automatically allowed. +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 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 +} + +// 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 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 +} + +// 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 VPN gateway connections that use a specified IKE policy +// This request lists VPN gateway connections that use an 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 *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(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)) + 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 { + err = core.SDKErrorf(err, "", "build-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, 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) + 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 VPN gateway connections that use a specified IPsec policy +// This request lists VPN gateway connections that use an 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 *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(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)) + 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 +} + +// 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 +} + +// 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.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 { + err = core.SDKErrorf(err, "", "build-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 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 +} + +// 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 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 +} + +// 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 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 + } + + 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. +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 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 +} + +// 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 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()) + 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 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 +} + +// 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 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 +} + +// 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.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()) + 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 load balancer must be in the `application` family. +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.FailsafePolicy != nil { + body["failsafe_policy"] = createLoadBalancerPoolOptions.FailsafePolicy + } + 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. +// +// The pool must not already have a member targeting a load balancer. +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, nor be the target pool in the failsafe policy for any other pool. +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 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 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 +} + +// 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 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 +} + +// 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 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 + } + + 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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 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 +} + +// 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.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 { + err = core.SDKErrorf(err, "", "build-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 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 TCP and UDP 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 +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} +func getServiceComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent(DefaultServiceName, "2025-04-08") +} + +// 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 address prefix. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that this address prefix was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether subnets exist with addresses from this address 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 +// - BackupPolicyMatchResourceTypeShare +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" + BackupPolicyMatchResourceTypeShareConst = "share" + 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. + // + // 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 []BackupPolicyTargetSnapshotIntf `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, UnmarshalBackupPolicyTargetSnapshot) + 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 *PageLink `json:"first" validate:"required"` + + // A page of jobs for the backup policy. + Jobs []BackupPolicyJob `json:"jobs" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. +func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) + if err != nil { + err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 +} + +// 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 +// - BackupPolicyJobSourceShareReference +type BackupPolicyJobSource struct { + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name,omitempty"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// 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, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A reason code for the status: + // - `internal_error`: Internal error (contact IBM support) + // - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable + // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state + // - `snapshot_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 + // size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) + // - `source_volume_unavailable`: The source volume is not attached to a running instance + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BackupPolicyJobStatusReason.Code property. +// A reason code for the status: +// - `internal_error`: Internal error (contact IBM support) +// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable +// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state +// - `snapshot_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 +// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) +// - `source_volume_unavailable`: The source volume is not attached to a running instance +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + 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" + BackupPolicyJobStatusReasonCodeSourceVolumeUnavailableConst = "source_volume_unavailable" +) + +// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. +func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // The included content for backups created using this policy: + // - `boot_volume`: Include the instance's boot volume. + // - `data_volumes`: Include the instance's data volumes. + IncludedContent []string `json:"included_content,omitempty"` + + // The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching + // user tag and a matching type will be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags,omitempty"` + + // The name for this backup policy. The name must not be used by another backup policy in the region. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the BackupPolicyPatch.IncludedContent property. +// An item to include. +const ( + BackupPolicyPatchIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyPatchIncludedContentDataVolumesConst = "data_volumes" +) + +// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPatch) + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPatch +func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPatch.IncludedContent) { + _patch["included_content"] = backupPolicyPatch.IncludedContent + } + if !core.IsNil(backupPolicyPatch.MatchUserTags) { + _patch["match_user_tags"] = backupPolicyPatch.MatchUserTags + } + if !core.IsNil(backupPolicyPatch.Name) { + _patch["name"] = backupPolicyPatch.Name + } + + return +} + +// BackupPolicyPlan : BackupPolicyPlan struct +type BackupPolicyPlan struct { + // Indicates whether the plan is active. + Active *bool `json:"active" validate:"required"` + + // The user tags to attach to backups (snapshots) created by this plan. + AttachUserTags []string `json:"attach_user_tags" validate:"required"` + + ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags" validate:"required"` + + // The date and time that the backup policy plan was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // 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 +} + +// asPatch returns a generic map representation of the BackupPolicyPlanClonePolicyPatch +func (backupPolicyPlanClonePolicyPatch *BackupPolicyPlanClonePolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanClonePolicyPatch.MaxSnapshots) { + _patch["max_snapshots"] = backupPolicyPlanClonePolicyPatch.MaxSnapshots + } + if !core.IsNil(backupPolicyPlanClonePolicyPatch.Zones) { + var zonesPatches []map[string]interface{} + for _, zones := range backupPolicyPlanClonePolicyPatch.Zones { + zonesPatches = append(zonesPatches, zones.asPatch()) + } + _patch["zones"] = zonesPatches + } + + return +} + +// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct +type BackupPolicyPlanClonePolicyPrototype struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + + // The zone this backup policy plan will create snapshot clones in. + Zones []ZoneIdentityIntf `json:"zones" validate:"required"` +} + +// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { + _model = &BackupPolicyPlanClonePolicyPrototype{ + Zones: zones, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicyPrototype) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of plans for the backup policy. + Plans []BackupPolicyPlan `json:"plans" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. +func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct +type BackupPolicyPlanDeletionTrigger struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after" validate:"required"` + + // The maximum number of recent backups to keep. If absent, there is no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTrigger) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct +type BackupPolicyPlanDeletionTriggerPatch struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the BackupPolicyPlanDeletionTriggerPatch +func (backupPolicyPlanDeletionTriggerPatch *BackupPolicyPlanDeletionTriggerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteAfter) { + _patch["delete_after"] = backupPolicyPlanDeletionTriggerPatch.DeleteAfter + } + if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteOverCount) { + _patch["delete_over_count"] = backupPolicyPlanDeletionTriggerPatch.DeleteOverCount + } + + return +} + +// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct +type BackupPolicyPlanDeletionTriggerPrototype struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. If unspecified, there will be no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct +type BackupPolicyPlanPatch struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user + // tags for backups that have already been created by this plan. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec,omitempty"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions (replacing any existing policies). + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPlanPatch +func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanPatch.Active) { + _patch["active"] = backupPolicyPlanPatch.Active + } + if !core.IsNil(backupPolicyPlanPatch.AttachUserTags) { + _patch["attach_user_tags"] = backupPolicyPlanPatch.AttachUserTags + } + if !core.IsNil(backupPolicyPlanPatch.ClonePolicy) { + _patch["clone_policy"] = backupPolicyPlanPatch.ClonePolicy.asPatch() + } + if !core.IsNil(backupPolicyPlanPatch.CopyUserTags) { + _patch["copy_user_tags"] = backupPolicyPlanPatch.CopyUserTags + } + if !core.IsNil(backupPolicyPlanPatch.CronSpec) { + _patch["cron_spec"] = backupPolicyPlanPatch.CronSpec + } + if !core.IsNil(backupPolicyPlanPatch.DeletionTrigger) { + _patch["deletion_trigger"] = backupPolicyPlanPatch.DeletionTrigger.asPatch() + } + if !core.IsNil(backupPolicyPlanPatch.Name) { + _patch["name"] = backupPolicyPlanPatch.Name + } + if !core.IsNil(backupPolicyPlanPatch.RemoteRegionPolicies) { + var remoteRegionPoliciesPatches []map[string]interface{} + for _, remoteRegionPolicies := range backupPolicyPlanPatch.RemoteRegionPolicies { + remoteRegionPoliciesPatches = append(remoteRegionPoliciesPatches, remoteRegionPolicies.asPatch()) + } + _patch["remote_region_policies"] = remoteRegionPoliciesPatches + } + + return +} + +// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct +type BackupPolicyPlanPrototype struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { + _model = &BackupPolicyPlanPrototype{ + CronSpec: core.StringPtr(cronSpec), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "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 *Deleted `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, 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, 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 +} + +// 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 +} + +// 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 +// - 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. + 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" + BackupPolicyPrototypeMatchResourceTypeShareConst = "share" + 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 +} + +// 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 + // 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"` + + // 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"` + + // 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 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"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this bare metal server: + // - `deleting`: server is undergoing deletion + // - `failed`: server is failed and not usable (see `status_reasons`) + // - `maintenance`: server is undergoing maintenance (not usable) + // - `pending`: server is being provisioned and not yet usable + // - `reinitializing`: server is reinitializing and not yet usable + // - `restarting`: server is restarting and not yet usable + // - `running`: server is powered on + // - `starting`: server is starting and not yet usable + // - `stopped`: server is powered off + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Status *string `json:"status" validate:"required"` + + // 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.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 ( + 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 this bare metal server: +// - `deleting`: server is undergoing deletion +// - `failed`: server is failed and not usable (see `status_reasons`) +// - `maintenance`: server is undergoing maintenance (not usable) +// - `pending`: server is being provisioned and not yet usable +// - `reinitializing`: server is reinitializing and not yet usable +// - `restarting`: server is restarting and not yet usable +// - `running`: server is powered on +// - `starting`: server is starting and not yet usable +// - `stopped`: server is powered off +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusReinitializingConst = "reinitializing" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" +) + +// 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.UnmarshalModel(m, "firmware", &obj.Firmware, UnmarshalBareMetalServerFirmware) + if err != nil { + 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()) + 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, "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()) + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href,omitempty"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id,omitempty"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BareMetalServerBootTarget.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { + return true +} + +type BareMetalServerBootTargetIntf interface { + isaBareMetalServerBootTarget() bool +} + +// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. +func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCpu : The bare metal server CPU configuration. +type BareMetalServerCpu struct { + // The CPU architecture. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + 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"` +} + +// Constants associated with the BareMetalServerCpu.Architecture property. +// The CPU architecture. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerCpuArchitectureAmd64Const = "amd64" + BareMetalServerCpuArchitectureS390xConst = "s390x" +) + +// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. +func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + err = core.SDKErrorf(err, "", "core_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + err = core.SDKErrorf(err, "", "threads_per_core-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // A page of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` + + // A link to the first page of resources. + First *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"` +} + +// 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, 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 *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 +} + +// 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 attachment interface used: + // - `fcp`: Fiber Channel Protocol + // - `sata`: Serial Advanced Technology Attachment + // - `nvme`: Non-Volatile Memory Express + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The 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 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 ( + 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 { + // The disks for the bare metal server. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` +} + +// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. +func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + err = core.SDKErrorf(err, "", "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) { + _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" + 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 +} + +// 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. + 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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 bare metal server 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"` +} + +// 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. + // + // 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. + 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { + return true +} + +type BareMetalServerNetworkAttachmentIntf interface { + isaBareMetalServerNetworkAttachment() bool +} + +// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // The network attachments for the bare metal server. + NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `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, 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, "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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.AllowedVlans) { + _patch["allowed_vlans"] = bareMetalServerNetworkAttachmentPatch.AllowedVlans + } + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.Name) { + _patch["name"] = bareMetalServerNetworkAttachmentPatch.Name + } + + 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 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"` + + // 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"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property. +// The protocol state filtering mode to use for this virtual network interface. If +// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` +// resource type: +// +// - `bare_metal_server_network_attachment`: disabled +// - `instance_network_attachment`: enabled +// - `share_mount_target`: enabled +// +// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any +// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering +// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. +const ( + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" +) + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) + return + } + err = core.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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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 *Deleted `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"` + + // 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. +// 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, 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, "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.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 +} + +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByHiperSocket +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on + // the attached virtual network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding + // network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on + // the attached virtual network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the floating IPs are associated + // with the attached virtual network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the identifier is that of the + // corresponding network attachment. + ID *string `json:"id" validate:"required"` + + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1Q tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1Q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the interface type is that of the + // corresponding network attachment. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be empty. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the + // attached virtual network interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding + // network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the port speed is that of its + // corresponding network attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of this bare metal server network interface. + 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // The network interfaces for the bare metal server. + NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, 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, "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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = bareMetalServerNetworkInterfacePatch.AllowIPSpoofing + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowedVlans) { + _patch["allowed_vlans"] = bareMetalServerNetworkInterfacePatch.AllowedVlans + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat) { + _patch["enable_infrastructure_nat"] = bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.Name) { + _patch["name"] = bareMetalServerNetworkInterfacePatch.Name + } + + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// Models which "extend" this model: +// - 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 +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified + // value must match one of the bandwidth values in the bare metal server's profile. + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server + // will fail to boot. + // + // For `enable_secure_boot` to be changed, the bare metal server `status` must be + // `stopped`. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing + // the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + ReservationAffinity *BareMetalServerReservationAffinityPatch `json:"reservation_affinity,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` +} + +// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. +func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPatch) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "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.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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()) + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerPatch.Bandwidth) { + _patch["bandwidth"] = bareMetalServerPatch.Bandwidth + } + if !core.IsNil(bareMetalServerPatch.EnableSecureBoot) { + _patch["enable_secure_boot"] = bareMetalServerPatch.EnableSecureBoot + } + if !core.IsNil(bareMetalServerPatch.Name) { + _patch["name"] = bareMetalServerPatch.Name + } + if !core.IsNil(bareMetalServerPatch.ReservationAffinity) { + _patch["reservation_affinity"] = bareMetalServerPatch.ReservationAffinity.asPatch() + } + if !core.IsNil(bareMetalServerPatch.TrustedPlatformModule) { + _patch["trusted_platform_module"] = bareMetalServerPatch.TrustedPlatformModule.asPatch() + } + + 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"` + + // 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"` + + ReservationTerms *BareMetalServerProfileReservationTerms `json:"reservation_terms" 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.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()) + 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.Default property. +// The default CPU architecture for a bare metal server with this profile. +const ( + BareMetalServerProfileCpuArchitectureDefaultAmd64Const = "amd64" + BareMetalServerProfileCpuArchitectureDefaultS390xConst = "s390x" +) + +// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" +) + +// Constants associated with the BareMetalServerProfileCpuArchitecture.Value property. +// The CPU architecture for a bare metal server with this profile. +const ( + BareMetalServerProfileCpuArchitectureValueAmd64Const = "amd64" + BareMetalServerProfileCpuArchitectureValueS390xConst = "s390x" +) + +// 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 +} + +// 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. + 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"` + + 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"` + + 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, "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()) + 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 +} + +// 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. + 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_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" + 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. +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, "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 +} + +// ClusterNetwork : ClusterNetwork struct +type ClusterNetwork struct { + // The date and time that the cluster network was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this cluster network. + CRN *string `json:"crn" validate:"required"` + + // The URL for this cluster network. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this cluster network. The name must not be used by another cluster network in the region. + Name *string `json:"name" validate:"required"` + + // The profile for this cluster network. + Profile *ClusterNetworkProfileReference `json:"profile" validate:"required"` + + // The resource group for this cluster network. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The IP address ranges available for subnets for this cluster network. + SubnetPrefixes []ClusterNetworkSubnetPrefix `json:"subnet_prefixes" 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 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 ( + ClusterNetworkResourceTypeClusterNetworkConst = "cluster_network" +) + +// 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, "", "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, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkLifecycleReason) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalClusterNetworkProfileReference) + 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, "subnet_prefixes", &obj.SubnetPrefixes, UnmarshalClusterNetworkSubnetPrefix) + if err != nil { + err = core.SDKErrorf(err, "", "subnet_prefixes-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 +} + +// ClusterNetworkCollection : ClusterNetworkCollection struct +type ClusterNetworkCollection struct { + // A page of cluster networks. + ClusterNetworks []ClusterNetwork `json:"cluster_networks" validate:"required"` + + // A link to the first page of resources. + First *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"` +} + +// 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, "", "cluster_networks-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 *ClusterNetworkCollection) 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 +} + +// 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"` + + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the cluster network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The URL for this cluster network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkInterfaceLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network interface. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The MAC address of the cluster network interface. May be absent if + // `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` + + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. + Name *string `json:"name" validate:"required"` + + // The cluster network subnet reserved IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *ClusterNetworkSubnetReference `json:"subnet,omitempty"` + + // The target of this cluster network interface. + // + // If 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 ClusterNetworkInterface.LifecycleState property. +// The lifecycle state of the cluster network interface. +const ( + ClusterNetworkInterfaceLifecycleStateDeletingConst = "deleting" + ClusterNetworkInterfaceLifecycleStateFailedConst = "failed" + ClusterNetworkInterfaceLifecycleStatePendingConst = "pending" + ClusterNetworkInterfaceLifecycleStateStableConst = "stable" + ClusterNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + ClusterNetworkInterfaceLifecycleStateUpdatingConst = "updating" + ClusterNetworkInterfaceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ClusterNetworkInterface.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +// UnmarshalClusterNetworkInterface unmarshals an instance of ClusterNetworkInterface from the specified map of raw messages. +func UnmarshalClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "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, "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, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkInterfaceLifecycleReason) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + err = core.SDKErrorf(err, "", "mac_address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkInterfaceTarget) + 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 +} + +// ClusterNetworkInterfaceCollection : ClusterNetworkInterfaceCollection struct +type ClusterNetworkInterfaceCollection struct { + // A link to the first page of resources. + 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 *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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.UnmarshalModel(m, "interfaces", &obj.Interfaces, UnmarshalClusterNetworkInterface) + if err != nil { + err = core.SDKErrorf(err, "", "interfaces-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 *ClusterNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// 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"` +} + +// 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, "", "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 +} + +// ClusterNetworkInterfacePatch : ClusterNetworkInterfacePatch struct +type ClusterNetworkInterfacePatch struct { + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. Must be + // `false` if the cluster network interface is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalClusterNetworkInterfacePatch unmarshals an instance of ClusterNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "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 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 + } + + return +} + +// 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"` +} + +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, "", "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 +} + +// ClusterNetworkInterfaceReference : The associated cluster network subnet. +type ClusterNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this 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 primary IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *ClusterNetworkSubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the ClusterNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceReferenceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +// 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, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + 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, UnmarshalClusterNetworkSubnetReservedIPReference) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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: +// - ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext +type ClusterNetworkInterfaceTarget struct { + // The URL for this instance cluster network attachment. + Href *string `json:"href,omitempty"` + + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id,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 resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ClusterNetworkInterfaceTarget.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceTargetResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" +) + +func (*ClusterNetworkInterfaceTarget) isaClusterNetworkInterfaceTarget() bool { + return true +} + +type ClusterNetworkInterfaceTargetIntf interface { + isaClusterNetworkInterfaceTarget() bool +} + +// 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, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + 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 +} + +// ClusterNetworkLifecycleReason : ClusterNetworkLifecycleReason struct +type ClusterNetworkLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // 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 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 ( + ClusterNetworkLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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, "", "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 +} + +// 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"` +} + +// 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 + } + + return +} + +// 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 URL for this cluster network profile. + Href *string `json:"href" validate:"required"` + + // 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"` + + // 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 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 ( + ClusterNetworkProfileFamilyVelaConst = "vela" +) + +// Constants associated with the ClusterNetworkProfile.ResourceType property. +// The resource type. +const ( + ClusterNetworkProfileResourceTypeClusterNetworkProfileConst = "cluster_network_profile" +) + +// 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, "", "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, "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, "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 +} + +// ClusterNetworkProfileCollection : ClusterNetworkProfileCollection struct +type ClusterNetworkProfileCollection 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 cluster network profiles. + Profiles []ClusterNetworkProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalClusterNetworkProfileCollection unmarshals an instance of ClusterNetworkProfileCollection from the specified map of raw messages. +func UnmarshalClusterNetworkProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + 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, UnmarshalClusterNetworkProfile) + 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 *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 URL for this cluster network profile. + Href *string `json:"href,omitempty"` +} + +func (*ClusterNetworkProfileIdentity) isaClusterNetworkProfileIdentity() bool { + return true +} + +type ClusterNetworkProfileIdentityIntf interface { + isaClusterNetworkProfileIdentity() bool +} + +// 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, "", "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 +} + +// ClusterNetworkProfileReference : ClusterNetworkProfileReference struct +type ClusterNetworkProfileReference struct { + // The URL for this cluster network profile. + Href *string `json:"href" validate:"required"` + + // 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 ClusterNetworkProfileReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkProfileReferenceResourceTypeClusterNetworkProfileConst = "cluster_network_profile" +) + +// UnmarshalClusterNetworkProfileReference unmarshals an instance of ClusterNetworkProfileReference from the specified map of raw messages. +func UnmarshalClusterNetworkProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "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 +} + +// ClusterNetworkReference : ClusterNetworkReference struct +type ClusterNetworkReference struct { + // The CRN for this cluster network. + 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 cluster network. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network. + ID *string `json:"id" validate:"required"` + + // The name for this cluster network. The name must not be used by another cluster network in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ClusterNetworkReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkReferenceResourceTypeClusterNetworkConst = "cluster_network" +) + +// 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, "", "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 +} + +// 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 date and time that the cluster network subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` + + // The IP version for this cluster network subnet. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + IPVersion *string `json:"ip_version" validate:"required"` + + // The IPv4 range of this cluster network subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkSubnetLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network subnet. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster + // network. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of IPv4 addresses in this cluster network subnet. + // + // Note: This is calculated as 2(32 - prefix length). For example, the prefix length `/24` gives:
+ // 2(32 - 24) = 28 = 256 addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` +} + +// Constants associated with the 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" +) + +// 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, "", "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, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + 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) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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, "", "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, "subnets", &obj.Subnets, UnmarshalClusterNetworkSubnet) + if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkSubnetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// ClusterNetworkSubnetIdentity : Identifies a cluster network subnet by a unique property. +// Models which "extend" this model: +// - 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.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 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 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 ( + ClusterNetworkSubnetLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkSubnetLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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()) + 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 +} + +// ClusterNetworkSubnetPatch : ClusterNetworkSubnetPatch struct +type ClusterNetworkSubnetPatch struct { + // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster + // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalClusterNetworkSubnetPatch unmarshals an instance of ClusterNetworkSubnetPatch from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 +} + +// 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 ( + ClusterNetworkSubnetPrefixAllocationPolicyAutoConst = "auto" +) + +// 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, "", "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 +} + +// ClusterNetworkSubnetPrefixPrototype : ClusterNetworkSubnetPrefixPrototype struct +type ClusterNetworkSubnetPrefixPrototype struct { + // The IPv4 range of the cluster network's subnet prefix, expressed in CIDR format. + // + // The CIDR prefix length must be less than `/29` (at least 8 addresses). + // + // If a range is specified that overlaps with address prefixes in the cluster network's VPC, the operating systems of + // any virtual server instances attaching to this cluster network must be [configured to avoid + // conflicts](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-cluster-network#advanced-consideration). + CIDR *string `json:"cidr,omitempty"` +} + +// UnmarshalClusterNetworkSubnetPrefixPrototype unmarshals an instance of ClusterNetworkSubnetPrefixPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrefixPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrefixPrototype) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) + if err != nil { + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetPrototype : ClusterNetworkSubnetPrototype struct +// Models which "extend" this model: +// - 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"` +} + +// 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 ClusterNetworkSubnetPrototypeIntf interface { + isaClusterNetworkSubnetPrototype() bool +} + +// 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, "", "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 +} + +// ClusterNetworkSubnetReference : ClusterNetworkSubnetReference struct +type ClusterNetworkSubnetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` + + // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster + // network. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the 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, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + 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 +} + +// 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"` + + // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` + // is deleted, or the cluster network subnet reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The 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"` +} + +// 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, "", "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 +} + +// ClusterNetworkSubnetReservedIPCollection : ClusterNetworkSubnetReservedIPCollection struct +type ClusterNetworkSubnetReservedIPCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of reserved IPs for the cluster network subnet. + ReservedIps []ClusterNetworkSubnetReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalClusterNetworkSubnetReservedIPCollection unmarshals an instance of ClusterNetworkSubnetReservedIPCollection from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "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, "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 +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkSubnetReservedIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// ClusterNetworkSubnetReservedIPLifecycleReason : ClusterNetworkSubnetReservedIPLifecycleReason struct +type ClusterNetworkSubnetReservedIPLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // An explanation of the 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 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, "", "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 +} + +// 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"` +} + +// 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, "", "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 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 + } + + return +} + +// 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"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this cluster network subnet 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 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 resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ClusterNetworkSubnetReservedIPReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPReferenceResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip" +) + +// 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 +} + +// 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"` + + // The URL for this cluster network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id,omitempty"` + + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ClusterNetworkSubnetReservedIPTarget.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPTargetResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +func (*ClusterNetworkSubnetReservedIPTarget) isaClusterNetworkSubnetReservedIPTarget() bool { + return true +} + +type ClusterNetworkSubnetReservedIPTargetIntf interface { + isaClusterNetworkSubnetReservedIPTarget() bool +} + +// 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, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + 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 +} + +// 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 +} + +// 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. + 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. 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. + 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="` + + // 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. + 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` + // + // 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` + // + // The `triple_des` algorithm has been deprecated. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // 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. + 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` +// +// The `md5` and `sha1` algorithms have been deprecated. +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` +// +// The `triple_des` algorithm has been deprecated. +const ( + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the CreateIpsecPolicyOptions.Pfs property. +// The Perfect Forward Secrecy group. +// +// 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" + 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 { + // 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` 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"` + + // 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 for 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 for 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 non-overlapping port range 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 concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // Supported for load balancers in the `application` family. + // + // If unspecified, the limit will be `15000` 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 + // 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. + // + // If unspecified, the timeout will be `50` 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. Each listener in the load balancer must have a non-overlapping port range and `protocol` + // combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. + // + // If `port_min` is also specified, `port` must have the same value as `port_min`. + 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`. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `65535`. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. Protocol values of `tcp`, `http` and + // `https` share the TCP port space. + 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`. + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified. + // + // If `port` is also specified, `port_min` must have the same value as `port`. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `1`. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. Protocol values of `tcp`, `http` and + // `https` share the TCP port space. + 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 non-overlapping port range 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_to_listener`: Requests will be forwarded to the specified + // `target` listener. + // - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. + // - `https_redirect`: Requests will be redirected to the specified `target.listener`. + // This listener must have a `protocol` of `http`, and the target listener must + // have a `protocol` of `https`. + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code. + Action *string `json:"action" validate:"required"` + + // 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this + // load balancer to forward to. + // - If `action` is `forward_to_pool`, 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. + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. +// The policy action: +// - `forward_to_listener`: Requests will be forwarded to the specified +// `target` listener. +// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. +// - `https_redirect`: Requests will be redirected to the specified `target.listener`. +// This listener must have a `protocol` of `http`, and the target listener must +// have a `protocol` of `https`. +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code. +const ( + CreateLoadBalancerListenerPolicyOptionsActionForwardToListenerConst = "forward_to_listener" + CreateLoadBalancerListenerPolicyOptionsActionForwardToPoolConst = "forward_to_pool" + 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 for the rule. + Condition *string `json:"condition" validate:"required"` + + // The content the rule applies to: + // - `body`: The UTF-8 form-encoded HTTP request body + // - `header`: The HTTP header + // - `hostname`: The fully-qualified domain name of the server specified in the Host + // HTTP request header + // - `path`: The path of the HTTP request + // - `query`: The query of the HTTP request URL + // - `sni_hostname`: The fully-qualified domain name of the server provided in the + // "server name indicator" extension during TLS negotiation + // + // - For listeners with `protocol` `http` or `https`, any type may be specified. + // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. + Type *string `json:"type" validate:"required"` + + // 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 to match for this rule. + // - If the `type` is `header`, this property must be specified. + // - If the `type` is `body` or `query`, this property may be specified. + // - For all other types, this property must not be specified. + 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 for the rule. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" + CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" + CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. +// The content the rule applies to: +// - `body`: The UTF-8 form-encoded HTTP request body +// - `header`: The HTTP header +// - `hostname`: The fully-qualified domain name of the server specified in the Host +// HTTP request header +// - `path`: The path of the HTTP request +// - `query`: The query of the HTTP request URL +// - `sni_hostname`: The fully-qualified domain name of the server provided in the +// "server name indicator" extension during TLS negotiation +// +// - For listeners with `protocol` `http` or `https`, any type may be specified. +// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" + CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" + CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" + CreateLoadBalancerListenerPolicyRuleOptionsTypeSniHostnameConst = "sni_hostname" +) + +// 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 set to `true`, 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. + // - 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"` + + // 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`. + // + // 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"` + + // 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 []LoadBalancerPoolPrototypeLoadBalancerContext `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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 +} + +// 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 + 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 []LoadBalancerPoolPrototypeLoadBalancerContext) *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. + // + // 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. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. + // + // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load + // balancer has a subnet in. + // + // 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. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // The weight of the server member. + // + // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` + // family. + // + // If unspecified, the weight will be `50` for load balancers in the `application` family. + 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. 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. + // + // If this pool has a member targeting a load balancer then: + // + // - If the targeted load balancer has multiple subnets, this health monitor will be + // used to direct traffic to the available subnets. + // - The health checks spawned by this health monitor will be handled as any other + // traffic (that is, subject to the configuration of listeners and pools on the target + // load balancer). + // - This health monitor does not affect how pool member health is determined within the + // target load balancer. + // + // For more information, see [Private Path network load balancer frequently asked + // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). + HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `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 failsafe policy to use for this pool. + // + // If unspecified, the default failsafe policy action from the profile will be used. + FailsafePolicy *LoadBalancerPoolFailsafePolicyPrototype `json:"failsafe_policy,omitempty"` + + // 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 + // + // 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 + // `source_ip_session_persistence_supported` set to `true` in its profile. + // + // If unspecified, session persistence will be disabled, and traffic will be distributed + // across 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. 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" + 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 +// +// For load balancers in the `network` family, this property must be `disabled`. +const ( + CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" + CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" + CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" +) + +// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions +func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, 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 LoadBalancerPoolHealthMonitorPrototypeIntf) *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 +} + +// SetFailsafePolicy : Allow user to set FailsafePolicy +func (_options *CreateLoadBalancerPoolOptions) SetFailsafePolicy(failsafePolicy *LoadBalancerPoolFailsafePolicyPrototype) *CreateLoadBalancerPoolOptions { + _options.FailsafePolicy = failsafePolicy + 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. + 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. +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 +} + +// 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. + 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 [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"` + + // 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: +// - `automatic`: The reservation will be automatically selected +// - `restricted`: The reservation must be manually requested. +const ( + CreateReservationOptionsAffinityPolicyAutomaticConst = "automatic" + 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 no traffic being allowed. + 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 +} + +// 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. + 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 +} + +// CreateVPCRouteResponse : CreateVPCRouteResponse struct +type CreateVPCRouteResponse struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Action *string `json:"action" validate:"required"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Origin *string `json:"origin" validate:"required"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. + // + // If subnets are attached to the route's routing table, egress traffic from those + // subnets in this zone will be subject to this route. If this route's routing table + // has any of `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic + // from those ingress sources arriving in this zone will be subject to this route. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the CreateVPCRouteResponse.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + CreateVPCRouteResponseActionDelegateConst = "delegate" + CreateVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" + CreateVPCRouteResponseActionDeliverConst = "deliver" + CreateVPCRouteResponseActionDropConst = "drop" +) + +// Constants associated with the CreateVPCRouteResponse.LifecycleState property. +// The lifecycle state of the route. +const ( + CreateVPCRouteResponseLifecycleStateDeletingConst = "deleting" + CreateVPCRouteResponseLifecycleStateFailedConst = "failed" + CreateVPCRouteResponseLifecycleStatePendingConst = "pending" + CreateVPCRouteResponseLifecycleStateStableConst = "stable" + CreateVPCRouteResponseLifecycleStateSuspendedConst = "suspended" + CreateVPCRouteResponseLifecycleStateUpdatingConst = "updating" + CreateVPCRouteResponseLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the CreateVPCRouteResponse.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 ( + CreateVPCRouteResponseOriginServiceConst = "service" + CreateVPCRouteResponseOriginUserConst = "user" +) + +// UnmarshalCreateVPCRouteResponse unmarshals an instance of CreateVPCRouteResponse from the specified map of raw messages. +func UnmarshalCreateVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CreateVPCRouteResponse) + 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 +} + +// 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 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"` + + // 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 +} + +// 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{} +} + +// 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 +} + +// 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 + 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. + // + // 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. + // + // 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 +// 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 +} + +// 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 (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. + NextHop RouteNextHopPrototypeIntf `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 RouteNextHopPrototypeIntf) *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. + // + // 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 + // 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 (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. + NextHop RouteNextHopPrototypeIntf `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 RouteNextHopPrototypeIntf) *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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + CRN *string `json:"crn" validate:"required"` +} + +// 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()) + 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 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"` +} + +// 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 +} + +// 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 +type DnsZoneIdentity struct { + ID *string `json:"id,omitempty"` +} + +func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { + return true +} + +type DnsZoneIdentityIntf interface { + isaDnsZoneIdentity() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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"` +} + +// 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"` + + // The disks for the dedicated host. + 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 { + // A page of dedicated hosts. + DedicatedHosts []DedicatedHost `json:"dedicated_hosts" 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"` +} + +// 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, 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 *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 +} + +// 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. + 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. + // + // 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. +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 { + // The disks for the dedicated host. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostDiskPatch.Name) { + _patch["name"] = dedicatedHostDiskPatch.Name + } + + 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostGroupPatch.Name) { + _patch["name"] = dedicatedHostGroupPatch.Name + } + + 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 *Deleted `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, 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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostPatch.InstancePlacementEnabled) { + _patch["instance_placement_enabled"] = dedicatedHostPatch.InstancePlacementEnabled + } + if !core.IsNil(dedicatedHostPatch.Name) { + _patch["name"] = dedicatedHostPatch.Name + } + + return +} + +// DedicatedHostProfile : DedicatedHostProfile struct +type DedicatedHostProfile struct { + // The product class this dedicated host profile belongs to. + Class *string `json:"class" validate:"required"` + + // The disks for a dedicated host with this profile. + 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 *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 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, 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, 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 +} + +// 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" +) + +// Constants associated with the DedicatedHostProfileVcpuArchitecture.Value property. +// The VCPU architecture for a dedicated host with this profile. +const ( + DedicatedHostProfileVcpuArchitectureValueAmd64Const = "amd64" + DedicatedHostProfileVcpuArchitectureValueS390xConst = "s390x" +) + +// 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" +) + +// Constants associated with the DedicatedHostProfileVcpuManufacturer.Value property. +// The VCPU manufacturer for a dedicated host with this profile. +const ( + DedicatedHostProfileVcpuManufacturerValueAmdConst = "amd" + DedicatedHostProfileVcpuManufacturerValueIBMConst = "ibm" + DedicatedHostProfileVcpuManufacturerValueIntelConst = "intel" +) + +// 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 *Deleted `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, 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 +} + +// 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. Created with: + // - The first rule, named `allow-inbound`, allowing ICMP, TCP and UDP inbound traffic. + // - The second rule, named `allow-outbound`, allowing ICMP, TCP, and UDP outbound + // traffic. + // + // 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. + // + // Created with filters allowing `vpn_gateway` and `vpn_server` resources to create routes, but filters may be added or + // removed with subsequent requests. + // + // 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 + // 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 CRN for this VPC routing table. + CRN *string `json:"crn" 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 group for this routing table. + ResourceGroup *ResourceGroupReference `json:"resource_group" 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. + // + // Set to `false` at VPC creation, but may be updated with subsequent requests. + // + // 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. + // + // Set to `false` at VPC creation, but may be updated with subsequent requests. + // + // 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. + // + // Set to `false` at VPC creation, but may be updated with subsequent requests. + // + // 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. + // + // Set to `false` at VPC creation, but may be updated with subsequent requests. + // + // 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, "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, "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.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_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 CRN for this security group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this security group. + 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. Created with: + // - A rule allowing inbound ICMP, TCP and UDP traffic from other interfaces in the + // VPC's default security group + // - A rule allowing outbound ICMP, TCP and UDP traffic to any destination + // + // 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The file 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 +} + +// 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. + 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 +} + +// 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 +} + +// 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. + 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 + // 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. 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. A domain name may have a wildcard prefix. + 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 { + // A page of endpoint gateways. + EndpointGateways []EndpointGateway `json:"endpoint_gateways" 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"` +} + +// 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, 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 *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 +} + +// 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 + // 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: +// - `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 +// support) +// +// 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" +) + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(endpointGatewayPatch.AllowDnsResolutionBinding) { + _patch["allow_dns_resolution_binding"] = endpointGatewayPatch.AllowDnsResolutionBinding + } + if !core.IsNil(endpointGatewayPatch.Name) { + _patch["name"] = endpointGatewayPatch.Name + } + + 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: +// - EndpointGatewayTargetPrivatePathServiceGatewayReference +// - 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"` + + // 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,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"` +} + +// Constants associated with the EndpointGatewayTarget.ResourceType property. +// The target resource type for this endpoint gateway. +const ( + EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_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, "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, "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, UnmarshalPrivatePathServiceGatewayRemote) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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: +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype +type EndpointGatewayTargetPrototype struct { + // 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"` +} + +// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. +// The target resource type for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + 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) { + obj := new(EndpointGatewayTargetPrototype) + 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.UnmarshalPrimitive(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 +} + +// 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. + // + // 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. + 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. +// +// 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" + 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct +type FloatingIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + 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"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPPatch.Name) { + _patch["name"] = floatingIPPatch.Name + } + if !core.IsNil(floatingIPPatch.Target) { + _patch["target"] = floatingIPPatch.Target.asPatch() + } + + 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 *Deleted `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, 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 + } + 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 *Deleted `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 primary IP address of this instance network interface. + 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, 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, "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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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: +// +// - 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 { + // The 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 *PageLink `json:"first" validate:"required"` + + // 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. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(flowLogCollectorPatch.Active) { + _patch["active"] = flowLogCollectorPatch.Active + } + if !core.IsNil(flowLogCollectorPatch.Name) { + _patch["name"] = flowLogCollectorPatch.Name + } + + 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 *Deleted `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"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,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, 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 + } + 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 + } + 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 +} + +// 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 +} + +// 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The file 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 +} + +// 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. + 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 +} + +// GetVPCRouteResponse : GetVPCRouteResponse struct +type GetVPCRouteResponse struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Action *string `json:"action" validate:"required"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Origin *string `json:"origin" validate:"required"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. + // + // If subnets are attached to the route's routing table, egress traffic from those + // subnets in this zone will be subject to this route. If this route's routing table + // has any of `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic + // from those ingress sources arriving in this zone will be subject to this route. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the GetVPCRouteResponse.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + GetVPCRouteResponseActionDelegateConst = "delegate" + GetVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" + GetVPCRouteResponseActionDeliverConst = "deliver" + GetVPCRouteResponseActionDropConst = "drop" +) + +// Constants associated with the GetVPCRouteResponse.LifecycleState property. +// The lifecycle state of the route. +const ( + GetVPCRouteResponseLifecycleStateDeletingConst = "deleting" + GetVPCRouteResponseLifecycleStateFailedConst = "failed" + GetVPCRouteResponseLifecycleStatePendingConst = "pending" + GetVPCRouteResponseLifecycleStateStableConst = "stable" + GetVPCRouteResponseLifecycleStateSuspendedConst = "suspended" + GetVPCRouteResponseLifecycleStateUpdatingConst = "updating" + GetVPCRouteResponseLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the GetVPCRouteResponse.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 ( + GetVPCRouteResponseOriginServiceConst = "service" + GetVPCRouteResponseOriginUserConst = "user" +) + +// UnmarshalGetVPCRouteResponse unmarshals an instance of GetVPCRouteResponse from the specified map of raw messages. +func UnmarshalGetVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GetVPCRouteResponse) + 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 +} + +// 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. + // + // 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. + 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. + // + // 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. + 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. + // + // 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. + 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. +// +// 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" + IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha384Const = "sha384" + IkePolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicy.EncryptionAlgorithm property. +// 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" + IkePolicyEncryptionAlgorithmAes256Const = "aes256" + IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IkePolicy.NegotiationMode property. +// 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" +) + +// 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// IkePolicyConnectionCollection : IkePolicyConnectionCollection struct +type IkePolicyConnectionCollection struct { + // 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. + 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"` +} + +// 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, 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 *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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(ikePolicyPatch.AuthenticationAlgorithm) { + _patch["authentication_algorithm"] = ikePolicyPatch.AuthenticationAlgorithm + } + 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 +} + +// IkePolicyReference : IkePolicyReference struct +type IkePolicyReference 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 IKE policy. + 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, 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 +} + +// 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 +} + +// 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 + // + // 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. + 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. + // + // 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 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. + 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"` + + // The Perfect Forward Secrecy group + // + // 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. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // 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"` +} + +// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. +// 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 ( + IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicy.EncapsulationMode property. +// 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" +) + +// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. +// 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 ( + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicy.Pfs property. +// The Perfect Forward Secrecy group +// +// 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" + 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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 *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"` +} + +// 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, 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 *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 +} + +// IPsecPolicyPatch : IPsecPolicyPatch struct +type IPsecPolicyPatch struct { + // The authentication algorithm + // + // 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` + // + // The `triple_des` algorithm has been deprecated. + 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"` + + // 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` +// +// The `md5` and `sha1` algorithms have been deprecated. +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` +// +// The `triple_des` algorithm has been deprecated. +const ( + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the IPsecPolicyPatch.Pfs property. +// The Perfect Forward Secrecy group. +// +// 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" + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(iPsecPolicyPatch.AuthenticationAlgorithm) { + _patch["authentication_algorithm"] = iPsecPolicyPatch.AuthenticationAlgorithm + } + 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 +} + +// IPsecPolicyReference : IPsecPolicyReference struct +type IPsecPolicyReference 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 IPsec policy. + 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, 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 +} + +// 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" validate:"required"` + + // The owner type of this image: + // - `user`: Owned by this account + // - `provider`: Owned by a different account. + OwnerType *string `json:"owner_type" validate:"required"` + + // 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 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. + 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.OwnerType property. +// The owner type of this image: +// - `user`: Owned by this account +// - `provider`: Owned by a different account. +const ( + ImageOwnerTypeProviderConst = "provider" + ImageOwnerTypeUserConst = "user" +) + +// 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.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 +// - `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.UnmarshalPrimitive(m, "owner_type", &obj.OwnerType) + if err != nil { + err = core.SDKErrorf(err, "", "owner_type-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, "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()) + 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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 resource type. + 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. + // + // 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 []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 resource type. +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. +// +// 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" + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(imageExportJobPatch.Name) { + _patch["name"] = imageExportJobPatch.Name + } + + 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 { + // The export jobs for the image. + 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, in hexadecimal. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(imagePatch.DeprecationAt) { + _patch["deprecation_at"] = imagePatch.DeprecationAt + } + if !core.IsNil(imagePatch.Name) { + _patch["name"] = imagePatch.Name + } + if !core.IsNil(imagePatch.ObsolescenceAt) { + _patch["obsolescence_at"] = imagePatch.ObsolescenceAt + } + + 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 *Deleted `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 *ImageRemoteContextImageReference `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, 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, UnmarshalImageRemoteContextImageReference) + 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 +} + +// ImageRemoteContextImageReference : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ImageRemoteContextImageReference 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"` +} + +// UnmarshalImageRemoteContextImageReference unmarshals an instance of ImageRemoteContextImageReference from the specified map of raw messages. +func UnmarshalImageRemoteContextImageReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageRemoteContextImageReference) + 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"` + + // 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"` + + // 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"` + + // 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"` + + // 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. + // + // 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. + 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.ConfidentialComputeMode property. +// The confidential compute mode for this virtual server instance. +const ( + InstanceConfidentialComputeModeDisabledConst = "disabled" + InstanceConfidentialComputeModeSgxConst = "sgx" + InstanceConfidentialComputeModeTdxConst = "tdx" +) + +// 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.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()) + 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.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()) + 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 +} + +// 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. + // - `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 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 + // 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, "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 +} + +// 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 { + // 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"` + + // 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, "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()) + 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 +} + +// 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"` + + // 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 *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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, "", "cluster_network_attachments-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 *InstanceClusterNetworkAttachmentCollection) 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 +} + +// InstanceClusterNetworkAttachmentLifecycleReason : InstanceClusterNetworkAttachmentLifecycleReason struct +type InstanceClusterNetworkAttachmentLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the InstanceClusterNetworkAttachmentLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceClusterNetworkAttachmentLifecycleReasonCodeInternalErrorConst = "internal_error" + InstanceClusterNetworkAttachmentLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceClusterNetworkAttachmentLifecycleReason unmarshals an instance of InstanceClusterNetworkAttachmentLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentPatch : InstanceClusterNetworkAttachmentPatch struct +type InstanceClusterNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + // Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceClusterNetworkAttachmentPatch unmarshals an instance of InstanceClusterNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceClusterNetworkAttachmentPatch +func (instanceClusterNetworkAttachmentPatch *InstanceClusterNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceClusterNetworkAttachmentPatch.Name) { + _patch["name"] = instanceClusterNetworkAttachmentPatch.Name + } + + return +} + +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface : A cluster network interface for the instance cluster network attachment. This can be specified using an existing +// cluster network interface that does not already have a `target`, or a prototype object for a new cluster network +// interface. +// +// This instance must reside in the same VPC as the specified cluster network interface. The cluster network interface +// must reside in the same cluster network as the +// `cluster_network_interface` of any other `cluster_network_attachments` for this instance. +// Models which "extend" this model: +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface struct { + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the cluster network interface. May be either + // a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP + // prototype object which will be used to create a new cluster network subnet reserved IP. + // + // If a cluster network subnet reserved IP identity is provided, the specified cluster + // network subnet reserved IP must be unbound. + // + // If a cluster network subnet reserved IP prototype object with an address is provided, + // the address must be available on the cluster network interface's cluster network + // subnet. If no address is specified, an available address on the cluster network subnet + // will be automatically selected and reserved. + PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The associated cluster network subnet. Required if `primary_ip` does not specify a + // cluster network subnet reserved IP identity. + Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id,omitempty"` + + // The URL for this cluster network interface. + Href *string `json:"href,omitempty"` +} + +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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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. + 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 { + // The disks for the instance. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceDiskPatch.Name) { + _patch["name"] = instanceDiskPatch.Name + } + + return +} + +// InstanceDiskReference : InstanceDiskReference struct +type InstanceDiskReference 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 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, 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 +} + +// 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. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + 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"` +} + +// Constants associated with the InstanceGpu.Manufacturer property. +// The GPU manufacturer. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceGpuManufacturerIntelConst = "intel" + InstanceGpuManufacturerNvidiaConst = "nvidia" +) + +// 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 + // + // 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. + 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 +// +// 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" + 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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. + 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. + 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 + // + // 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. + 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 +// +// 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" + 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 +} + +// 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. + 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 +} + +// 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 + // `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"` + + 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, "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()) + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerActionPatch.AutoDelete) { + _patch["auto_delete"] = instanceGroupManagerActionPatch.AutoDelete + } + 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 +} + +// 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 *Deleted `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, 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 +} + +// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct +type InstanceGroupManagerActionsCollection struct { + // A page of actions for the instance group manager. + Actions []InstanceGroupManagerActionIntf `json:"actions" 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"` +} + +// 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, 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 *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 +} + +// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct +type InstanceGroupManagerCollection 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 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 + // except the last page. + Next *PageLink `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, 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, "managers", &obj.Managers, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "managers-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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerPatch.AggregationWindow) { + _patch["aggregation_window"] = instanceGroupManagerPatch.AggregationWindow + } + 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 +} + +// 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 + // + // 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 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 enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 *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 policies for the instance group manager. + 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, 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, "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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerPolicyPatch.MetricType) { + _patch["metric_type"] = instanceGroupManagerPolicyPatch.MetricType + } + if !core.IsNil(instanceGroupManagerPolicyPatch.MetricValue) { + _patch["metric_value"] = instanceGroupManagerPolicyPatch.MetricValue + } + if !core.IsNil(instanceGroupManagerPolicyPatch.Name) { + _patch["name"] = instanceGroupManagerPolicyPatch.Name + } + + 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 *Deleted `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, 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 + } + 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 *Deleted `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, 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 + } + 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 *Deleted `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, 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, "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 + // + // 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. + 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 +// +// 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" + 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // 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 + // except the last page. + Next *PageLink `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, 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, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) + if err != nil { + err = core.SDKErrorf(err, "", "memberships-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 *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 +} + +// 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"` +} + +// 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()) + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete) { + _patch["delete_instance_on_membership_delete"] = instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete + } + if !core.IsNil(instanceGroupMembershipPatch.Name) { + _patch["name"] = instanceGroupMembershipPatch.Name + } + + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupPatch.ApplicationPort) { + _patch["application_port"] = instanceGroupPatch.ApplicationPort + } + 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 +} + +// 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 *Deleted `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, 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 + } + 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. + // + // 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"` + + // 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. +// +// 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" + 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: + // - `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. + 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: +// - `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" +) + +// 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 +} + +// 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. + 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 { + // The network attachments for the instance. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceNetworkAttachmentPatch.Name) { + _patch["name"] = instanceNetworkAttachmentPatch.Name + } + + 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 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"` + + // 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"` +} + +// 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 +} + +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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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 *Deleted `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"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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, 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, "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.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 +} + +// InstancePatch : InstancePatch struct +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"` + + // 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. 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`. + // - 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"` +} + +// 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" + InstancePatchConfidentialComputeModeTdxConst = "tdx" +) + +// 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.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()) + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePatch.AvailabilityPolicy) { + _patch["availability_policy"] = instancePatch.AvailabilityPolicy.asPatch() + } + 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. 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`. +// - 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 +// - 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 *Deleted `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, 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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 +// - 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"` + + 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. + 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"` + + 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. + // - `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"` + + // 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"` + + 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, "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()) + 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.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()) + 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()) + 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 +} + +// 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. + 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" +) + +// Constants associated with the InstanceProfileGpuManufacturer.Values property. +// The GPU manufacturer. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceProfileGpuManufacturerValuesIntelConst = "intel" + InstanceProfileGpuManufacturerValuesNvidiaConst = "nvidia" +) + +// 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 +} + +// 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" + InstanceProfileSupportedConfidentialComputeModesDefaultTdxConst = "tdx" +) + +// 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: +// - `disabled`: No confidential compute functionality +// - `sgx`: Intel Software Guard Extensions +// - `tdx`: Intel Trust Domain Extensions +// +// 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" + InstanceProfileSupportedConfidentialComputeModesValuesTdxConst = "tdx" +) + +// 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 +// - 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 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" +) + +// Constants associated with the InstanceProfileVcpuArchitecture.Value property. +// The VCPU architecture for an instance with this profile. +const ( + InstanceProfileVcpuArchitectureValueAmd64Const = "amd64" + InstanceProfileVcpuArchitectureValueS390xConst = "s390x" +) + +// 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, "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 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" +) + +// Constants associated with the InstanceProfileVcpuManufacturer.Value property. +// The VCPU manufacturer for an instance with this profile. +const ( + InstanceProfileVcpuManufacturerValueAmdConst = "amd" + InstanceProfileVcpuManufacturerValueIBMConst = "ibm" + InstanceProfileVcpuManufacturerValueIntelConst = "intel" +) + +// 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, "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 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. + 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. 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 *Deleted `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, 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 + } + 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: + // - `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 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: +// - `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 ( + InstanceReservationAffinityPolicyAutomaticConst = "automatic" + 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: + // - `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. + 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`, `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: +// - `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 ( + InstanceReservationAffinityPatchPolicyAutomaticConst = "automatic" + 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 +} + +// 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: + // - `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 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. + // + // 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 +// - `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 must be `disabled` if `placement_target` is specified. +const ( + InstanceReservationAffinityPrototypePolicyAutomaticConst = "automatic" + 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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 *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 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, 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, "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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplatePatch.Name) { + _patch["name"] = instanceTemplatePatch.Name + } + + 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 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. + 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. 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 *Deleted `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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceVcpu : The virtual server instance VCPU configuration. +type InstanceVcpu struct { + // The VCPU architecture. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// Constants associated with the InstanceVcpu.Architecture property. +// The VCPU architecture. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceVcpuArchitectureAmd64Const = "amd64" + InstanceVcpuArchitectureS390xConst = "s390x" +) + +// Constants associated with the InstanceVcpu.Manufacturer property. +// The VCPU manufacturer. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceVcpuManufacturerAmdConst = "amd" + InstanceVcpuManufacturerIBMConst = "ibm" + InstanceVcpuManufacturerIntelConst = "intel" +) + +// 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 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 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" +) + +// 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 *PageLink `json:"first" validate:"required"` + + // A page 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 *PageLink `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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(keyPatch.Name) { + _patch["name"] = keyPatch.Name + } + + 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 *Deleted `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, UnmarshalDeleted) + 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 +} + +// 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 `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"` + + // 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 +} + +// 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) + 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 +} + +// 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. + 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 `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"` + + // 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 +} + +// 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{} +} + +// 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 +} + +// 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) + 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="` + + // 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 +} + +// 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 +} + +// 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 + 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"` + + // 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"` + + // Filters the collection to images with an `owner_type` property matching the specified value. + OwnerType *string `json:"owner_type,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" +) + +// Constants associated with the ListImagesOptions.UserDataFormat property. +const ( + ListImagesOptionsUserDataFormatCloudInitConst = "cloud_init" + ListImagesOptionsUserDataFormatEsxiKickstartConst = "esxi_kickstart" + ListImagesOptionsUserDataFormatIpxeConst = "ipxe" +) + +// Constants associated with the ListImagesOptions.OwnerType property. +// Filters the collection to images with an `owner_type` property matching the specified value. +const ( + ListImagesOptionsOwnerTypeProviderConst = "provider" + ListImagesOptionsOwnerTypeUserConst = "user" +) + +// 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 +} + +// SetUserDataFormat : Allow user to set UserDataFormat +func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *ListImagesOptions { + _options.UserDataFormat = userDataFormat + return _options +} + +// SetOwnerType : Allow user to set OwnerType +func (_options *ListImagesOptions) SetOwnerType(ownerType string) *ListImagesOptions { + _options.OwnerType = core.StringPtr(ownerType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { + options.Headers = param + 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. + 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 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"` + + // 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 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"` + + // 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"` + + // 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 +} + +// 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{} +} + +// 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 +} + +// 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) + 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 +} + +// 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) + 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="` + + // 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 +} + +// 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 +} + +// 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 + 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"` + + // 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 +} + +// 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 +} + +// 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 + 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 +} + +// 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. + 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 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"` + + // 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 +} + +// 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{} +} + +// 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 +} + +// 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) + 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 +} + +// 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. + 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 +} + +// 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. + 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 a `crn` 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 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 a `name` property matching the exact specified name. + Name *string `json:"name,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 an item in the `tags` property matching the exact specified tag. + Tag *string `json:"tag,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 +} + +// 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 +} + +// 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 +} + +// SetName : Allow user to set Name +func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { + _options.Name = core.StringPtr(name) + 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 +} + +// SetTag : Allow user to set Tag +func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions { + _options.Tag = core.StringPtr(tag) + 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 +} + +// 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="` + + // 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 +} + +// 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 +} + +// 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 *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 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 load balancer pool members attached to this load balancer. + AttachedLoadBalancerPoolMembers []LoadBalancerPoolMemberReference `json:"attached_load_balancer_pool_members" 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"` + + // The CRN for this load balancer. + 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`. + // + // Not supported by private path load balancers. + Dns *LoadBalancerDns `json:"dns,omitempty"` + + // The supported `failsafe_policy.action` values for this load balancer's pools. + FailsafePolicyActions []string `json:"failsafe_policy_actions" validate:"required"` + + // Fully qualified domain name assigned to this load balancer. + Hostname *string `json:"hostname" validate:"required"` + + // 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"` + + // 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"` + + // 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. + // + // 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. + 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. + 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. + // + // Will be empty if `is_public` is `false`. + 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // Indicates whether this load balancer supports security groups. + SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` + + // 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"` + + // Indicates whether this load balancer supports UDP. + 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.FailsafePolicyActions property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. +// - `drop`: Drops requests. +// - `fail`: Fails requests with an HTTP `503` status code. +// - `forward`: Forwards requests to the `target` pool. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerFailsafePolicyActionsBypassConst = "bypass" + LoadBalancerFailsafePolicyActionsDropConst = "drop" + LoadBalancerFailsafePolicyActionsFailConst = "fail" + LoadBalancerFailsafePolicyActionsForwardConst = "forward" +) + +// 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" +) + +// 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, "access_mode", &obj.AccessMode) + if err != nil { + err = core.SDKErrorf(err, "", "access_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "attached_load_balancer_pool_members", &obj.AttachedLoadBalancerPoolMembers, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + err = core.SDKErrorf(err, "", "attached_load_balancer_pool_members-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()) + 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, "failsafe_policy_actions", &obj.FailsafePolicyActions) + if err != nil { + err = core.SDKErrorf(err, "", "failsafe_policy_actions-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_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()) + 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, UnmarshalReservedIPReference) + 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.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()) + 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // 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 + // except the last page. + Next *PageLink `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, 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, "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, 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 *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 +} + +// 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`. +// +// Not supported by private path load balancers. +type LoadBalancerDns struct { + // The DNS instance associated with this load balancer. + Instance *DnsInstanceReferenceLoadBalancerDnsContext `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, UnmarshalDnsInstanceReferenceLoadBalancerDnsContext) + 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`. +// +// Not supported by private path load balancers. +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 +} + +// 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 +// `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. + // + // 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 CRN for this load balancer. + CRN *string `json:"crn,omitempty"` + + // The URL for this load balancer. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerIdentityIntf interface { + isaLoadBalancerIdentity() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 + // 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 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"` + + // 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 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 + // 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. + PortMax *int64 `json:"port_max" validate:"required"` + + // The inclusive lower bound of the range of ports used by this 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 { + // The listeners for the load balancer. + 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 URL for this load balancer pool. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +type LoadBalancerListenerDefaultPoolPatchIntf interface { + isaLoadBalancerListenerDefaultPoolPatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + 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 +} + +// 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. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + 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 URL for this load balancer listener. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerIdentityIntf interface { + isaLoadBalancerListenerIdentity() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 + // 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 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 + // 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 inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. Updating + // `port` updates `port_min` to the same value. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `1`. + // + // Each listener in the load balancer must have a non-overlapping port range and + // `protocol` combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. + 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`. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `65535`. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. Protocol values of `tcp`, `http` and + // `https` share the TCP port space. + 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`. Updating + // `port_min` updates `port` to the same value. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `1`. + // + // Each listener in the load balancer must have a non-overlapping port range and + // `protocol` combination. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a non-overlapping port range 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 non-overlapping port range 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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPatch.AcceptProxyProtocol) { + _patch["accept_proxy_protocol"] = loadBalancerListenerPatch.AcceptProxyProtocol + } + 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: + // - `forward_to_listener`: Requests will be forwarded to the specified `target` + // listener + // - `forward_to_pool`: 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 URL for this load balancer policy. + Href *string `json:"href" validate:"required"` + + // 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 + // 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_to_listener`, specify a `LoadBalancerListenerIdentity` + // - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` + // - 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_to_listener`: Requests will be forwarded to the specified `target` +// listener +// - `forward_to_pool`: 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 ( + LoadBalancerListenerPolicyActionForwardToListenerConst = "forward_to_listener" + LoadBalancerListenerPolicyActionForwardToPoolConst = "forward_to_pool" + 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 { + // The policies for the load balancer listener. + 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_to_listener`, specify a `LoadBalancerListenerIdentity` for a + // listener in this load balancer. + // - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in + // this load balancer. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer + // with a `protocol` of `https`. + // - 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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyPatch.Name) { + _patch["name"] = loadBalancerListenerPolicyPatch.Name + } + 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: + // - `forward_to_listener`: Requests will be forwarded to the specified + // `target` listener. + // - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. + // - `https_redirect`: Requests will be redirected to the specified `target.listener`. + // This listener must have a `protocol` of `http`, and the target listener must + // have a `protocol` of `https`. + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code. + Action *string `json:"action" validate:"required"` + + // 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this + // load balancer to forward to. + // - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to specify a pool in + // this load balancer to forward to. + // - If `action` is `https_redirect`, use + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this + // load balancer to redirect to. + // - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to + // specify a URL to redirect to. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. +// The policy action: +// - `forward_to_listener`: Requests will be forwarded to the specified +// `target` listener. +// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. +// - `https_redirect`: Requests will be redirected to the specified `target.listener`. +// This listener must have a `protocol` of `http`, and the target listener must +// have a `protocol` of `https`. +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code. +const ( + LoadBalancerListenerPolicyPrototypeActionForwardToListenerConst = "forward_to_listener" + LoadBalancerListenerPolicyPrototypeActionForwardToPoolConst = "forward_to_pool" + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer policy. + Href *string `json:"href" validate:"required"` + + // 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 + // 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct +type LoadBalancerListenerPolicyRule struct { + // 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. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // 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. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener policy rule. + 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. + // + // 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. + // + // 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 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" + 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. +// +// 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" + LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRuleTypePathConst = "path" + LoadBalancerListenerPolicyRuleTypeQueryConst = "query" + LoadBalancerListenerPolicyRuleTypeSniHostnameConst = "sni_hostname" +) + +// 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 { + // The rules for the load balancer listener policy. + 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 for the rule. + Condition *string `json:"condition,omitempty"` + + // The field to match for this rule. + // - If the `type` is `header`, this property must be specified. + // - If the `type` is `body` or `query`, this property may be specified. + // - For all other types, this property must not be specified. + Field *string `json:"field,omitempty"` + + // The content the rule applies to: + // - `body`: The UTF-8 form-encoded HTTP request body + // - `header`: The HTTP header + // - `hostname`: The fully-qualified domain name of the server specified in the Host + // HTTP request header + // - `path`: The path of the HTTP request + // - `query`: The query of the HTTP request URL + // - `sni_hostname`: The fully-qualified domain name of the server provided in the + // "server name indicator" extension during TLS negotiation + // + // - For listeners with `protocol` `http` or `https`, any type may be specified. + // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. + Type *string `json:"type,omitempty"` + + // 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"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. +// The condition for the rule. +const ( + LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. +// The content the rule applies to: +// - `body`: The UTF-8 form-encoded HTTP request body +// - `header`: The HTTP header +// - `hostname`: The fully-qualified domain name of the server specified in the Host +// HTTP request header +// - `path`: The path of the HTTP request +// - `query`: The query of the HTTP request URL +// - `sni_hostname`: The fully-qualified domain name of the server provided in the +// "server name indicator" extension during TLS negotiation +// +// - For listeners with `protocol` `http` or `https`, any type may be specified. +// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. +const ( + LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePatchTypePathConst = "path" + LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" + LoadBalancerListenerPolicyRulePatchTypeSniHostnameConst = "sni_hostname" +) + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyRulePatch.Condition) { + _patch["condition"] = loadBalancerListenerPolicyRulePatch.Condition + } + 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 for the rule. + Condition *string `json:"condition" validate:"required"` + + // The field to match for this rule. + // - If the `type` is `header`, this property must be specified. + // - If the `type` is `body` or `query`, this property may be specified. + // - For all other types, this property must not be specified. + Field *string `json:"field,omitempty"` + + // The content the rule applies to: + // - `body`: The UTF-8 form-encoded HTTP request body + // - `header`: The HTTP header + // - `hostname`: The fully-qualified domain name of the server specified in the Host + // HTTP request header + // - `path`: The path of the HTTP request + // - `query`: The query of the HTTP request URL + // - `sni_hostname`: The fully-qualified domain name of the server provided in the + // "server name indicator" extension during TLS negotiation + // + // - For listeners with `protocol` `http` or `https`, any type may be specified. + // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. + Type *string `json:"type" validate:"required"` + + // 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"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. +// The condition for the rule. +const ( + LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. +// The content the rule applies to: +// - `body`: The UTF-8 form-encoded HTTP request body +// - `header`: The HTTP header +// - `hostname`: The fully-qualified domain name of the server specified in the Host +// HTTP request header +// - `path`: The path of the HTTP request +// - `query`: The query of the HTTP request URL +// - `sni_hostname`: The fully-qualified domain name of the server provided in the +// "server name indicator" extension during TLS negotiation +// +// - For listeners with `protocol` `http` or `https`, any type may be specified. +// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. +const ( + LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" + LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" + LoadBalancerListenerPolicyRulePrototypeTypeSniHostnameConst = "sni_hostname" +) + +// 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer listener policy rule. + Href *string `json:"href" validate:"required"` + + // 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTarget : - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` +// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` +// - 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 +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerReference +type LoadBalancerListenerPolicyTarget 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 load balancer pool. + 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. 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"` +} + +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, 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, "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_to_listener`, specify a `LoadBalancerListenerIdentity` for a +// +// listener in this load balancer. +// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in +// this load balancer. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer +// with a `protocol` of `https`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity +type LoadBalancerListenerPolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer pool. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` + + // 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"` +} + +func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchIntf interface { + isaLoadBalancerListenerPolicyTargetPatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this +// +// load balancer to forward to. +// - If `action` is `forward_to_pool`, 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 +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype +type LoadBalancerListenerPolicyTargetPrototype struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer pool. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` + + // 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"` +} + +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 concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // Supported for load balancers in the `application` family. + // + // If unspecified, the limit will be `15000` 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 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. + // + // If unspecified, the timeout will be `50` for load balancers in the `application` family. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The listener port number. Each listener in the load balancer must have a non-overlapping port range and `protocol` + // combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. + // + // If `port_min` is also specified, `port` must have the same value as `port_min`. + 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`. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `65535`. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. Protocol values of `tcp`, `http` and + // `https` share the TCP port space. + 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`. + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified. + // + // If `port` is also specified, `port_min` must have the same value as `port`. + // + // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to + // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be + // `1`. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. Protocol values of `tcp`, `http` and + // `https` share the TCP port space. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a non-overlapping port range 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 non-overlapping port range 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer listener. + 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, 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 + } + 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 +} + +// 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. + 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 +} + +// 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. + 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`. + // + // Not supported by private path load balancers. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPatch.Dns) { + _patch["dns"] = loadBalancerPatch.Dns.asPatch() + } + 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. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + FailsafePolicy *LoadBalancerPoolFailsafePolicy `json:"failsafe_policy" validate:"required"` + + // The health monitor of this pool. + // + // If this pool has a member targeting a load balancer then: + // + // - If the targeted load balancer has multiple subnets, this health monitor is used to + // direct traffic to the available subnets. + // - The health checks spawned by this health monitor is handled as any other traffic + // (that is, subject to the configuration of listeners and pools on the target load + // balancer). + // - This health monitor does not affect how pool member health is determined within the + // target load balancer. + // + // For more information, see [Private Path network load balancer frequently asked + // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). + HealthMonitor LoadBalancerPoolHealthMonitorIntf `json:"health_monitor" validate:"required"` + + // The URL for this load balancer pool. + 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 + // + // 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. + // + // 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"` +} + +// 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" + 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 +// +// 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" + 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, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicy) + if err != nil { + err = core.SDKErrorf(err, "", "failsafe_policy-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 { + // The pools for the load balancer. + 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 +} + +// LoadBalancerPoolFailsafePolicy : LoadBalancerPoolFailsafePolicy struct +type LoadBalancerPoolFailsafePolicy struct { + // A load balancer failsafe policy action: + // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. + // - `drop`: Drops requests. + // - `fail`: Fails requests with an HTTP `503` status code. + // - `forward`: Forwards requests to the `target` pool. + // + // 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 healthy member count at which the failsafe policy action will be triggered. At present, this is always `0`, but + // may be modifiable in the future. + HealthyMemberThresholdCount *int64 `json:"healthy_member_threshold_count" validate:"required"` + + // If `action` is `forward`, the target pool to forward to. + // + // If `action` is not `forward`, this property will be absent. + // + // The targets supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Target *LoadBalancerPoolReference `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerPoolFailsafePolicy.Action property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. +// - `drop`: Drops requests. +// - `fail`: Fails requests with an HTTP `503` status code. +// - `forward`: Forwards requests to the `target` pool. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerPoolFailsafePolicyActionBypassConst = "bypass" + LoadBalancerPoolFailsafePolicyActionDropConst = "drop" + LoadBalancerPoolFailsafePolicyActionFailConst = "fail" + LoadBalancerPoolFailsafePolicyActionForwardConst = "forward" +) + +// UnmarshalLoadBalancerPoolFailsafePolicy unmarshals an instance of LoadBalancerPoolFailsafePolicy from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicy) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "healthy_member_threshold_count", &obj.HealthyMemberThresholdCount) + if err != nil { + err = core.SDKErrorf(err, "", "healthy_member_threshold_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolReference) + if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolFailsafePolicyPatch : The failsafe policy for this load balancer pool. +type LoadBalancerPoolFailsafePolicyPatch struct { + // A load balancer failsafe policy action: + // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load + // balancer must have `route_mode` enabled. + // - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. + // - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. + // - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. + // + // The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. + Action *string `json:"action,omitempty"` + + // The failsafe target pool to forward to. + // + // The specified pool must: + // - Belong to this load balancer + // - Have the same `protocol` as this pool, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not have a `failsafe_policy.action` of `forward` or `bypass`. + // + // If specified, `action` must be `forward`. + // + // Specify `null` to remove an existing failsafe target pool. + Target LoadBalancerPoolFailsafePolicyTargetPatchIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerPoolFailsafePolicyPatch.Action property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load +// balancer must have `route_mode` enabled. +// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. +// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. +// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. +// +// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. +const ( + LoadBalancerPoolFailsafePolicyPatchActionBypassConst = "bypass" + LoadBalancerPoolFailsafePolicyPatchActionDropConst = "drop" + LoadBalancerPoolFailsafePolicyPatchActionFailConst = "fail" + LoadBalancerPoolFailsafePolicyPatchActionForwardConst = "forward" +) + +// UnmarshalLoadBalancerPoolFailsafePolicyPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicyPatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch) + 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 LoadBalancerPoolFailsafePolicyPatch +func (loadBalancerPoolFailsafePolicyPatch *LoadBalancerPoolFailsafePolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Action) { + _patch["action"] = loadBalancerPoolFailsafePolicyPatch.Action + } + if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Target) { + _patch["target"] = loadBalancerPoolFailsafePolicyPatch.Target.asPatch() + } + + return +} + +// LoadBalancerPoolFailsafePolicyPrototype : LoadBalancerPoolFailsafePolicyPrototype struct +type LoadBalancerPoolFailsafePolicyPrototype struct { + // A load balancer failsafe policy action: + // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load + // balancer must have `route_mode` enabled. + // - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. + // - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. + // - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. + // + // The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. + Action *string `json:"action,omitempty"` + + // The failsafe target pool to forward to. + // + // The specified pool must: + // - Belong to this load balancer + // - Have the same `protocol` as this pool, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Have a `failsafe_policy.action` of `fail` or `drop` + // + // If specified, `action` must be `forward`. + Target LoadBalancerPoolIdentityIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerPoolFailsafePolicyPrototype.Action property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load +// balancer must have `route_mode` enabled. +// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. +// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. +// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. +// +// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. +const ( + LoadBalancerPoolFailsafePolicyPrototypeActionBypassConst = "bypass" + LoadBalancerPoolFailsafePolicyPrototypeActionDropConst = "drop" + LoadBalancerPoolFailsafePolicyPrototypeActionFailConst = "fail" + LoadBalancerPoolFailsafePolicyPrototypeActionForwardConst = "forward" +) + +// UnmarshalLoadBalancerPoolFailsafePolicyPrototype unmarshals an instance of LoadBalancerPoolFailsafePolicyPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicyPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolFailsafePolicyTargetPatch : The failsafe target pool to forward to. +// +// The specified pool must: +// - Belong to this load balancer +// - Have the same `protocol` as this pool, or have a compatible protocol. +// At present, the compatible protocols are `http` and `https`. +// - Not have a `failsafe_policy.action` of `forward` or `bypass`. +// +// If specified, `action` must be `forward`. +// +// Specify `null` to remove an existing failsafe target pool. +// Models which "extend" this model: +// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID +// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref +type LoadBalancerPoolFailsafePolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer pool. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolFailsafePolicyTargetPatch) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { + return true +} + +type LoadBalancerPoolFailsafePolicyTargetPatchIntf interface { + isaLoadBalancerPoolFailsafePolicyTargetPatch() bool + asPatch() map[string]interface{} +} + +// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicyTargetPatch) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatch +func (loadBalancerPoolFailsafePolicyTargetPatch *LoadBalancerPoolFailsafePolicyTargetPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.ID) { + _patch["id"] = loadBalancerPoolFailsafePolicyTargetPatch.ID + } + if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.Href) { + _patch["href"] = loadBalancerPoolFailsafePolicyTargetPatch.Href + } + + return +} + +// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct +// Models which "extend" this model: +// - LoadBalancerPoolHealthMonitorTypeTCP +// - LoadBalancerPoolHealthMonitorTypeHttphttps +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 used 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, 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 used 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" +) + +func (*LoadBalancerPoolHealthMonitor) isaLoadBalancerPoolHealthMonitor() bool { + return true +} + +type LoadBalancerPoolHealthMonitorIntf interface { + isaLoadBalancerPoolHealthMonitor() bool +} + +// 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. 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). + // + // Specify `null` to remove a url_path. + 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 +} + +// 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 +// Models which "extend" this model: +// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype +// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype +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 to use. + // + // 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" +) + +func (*LoadBalancerPoolHealthMonitorPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { + return true +} + +type LoadBalancerPoolHealthMonitorPrototypeIntf interface { + isaLoadBalancerPoolHealthMonitorPrototype() bool +} + +// 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 URL for this load balancer pool. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerPoolIdentityIntf interface { + isaLoadBalancerPoolIdentity() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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. + // + // 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. + 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. + Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` + + // The weight of the server member. + // + // This property will be present 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. +// +// 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" + 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 { + // The members for the load balancer pool. + 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. + // + // 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. + Port *int64 `json:"port,omitempty"` + + // The pool member target. + // + // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load + // balancer has a subnet in. + // + // 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. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` + + // The weight of the server member. + // + // If specified, the pool algorithm must be `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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberPatch.Port) { + _patch["port"] = loadBalancerPoolMemberPatch.Port + } + if !core.IsNil(loadBalancerPoolMemberPatch.Target) { + _patch["target"] = loadBalancerPoolMemberPatch.Target.asPatch() + } + if !core.IsNil(loadBalancerPoolMemberPatch.Weight) { + _patch["weight"] = loadBalancerPoolMemberPatch.Weight + } + + 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. + // + // 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. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. + // + // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load + // balancer has a subnet in. + // + // 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. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // The weight of the server member. + // + // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` + // family. + // + // If unspecified, the weight will be `50` for load balancers in the `application` family. + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer pool member. + 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTarget : The pool member target. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetInstanceReference +// - LoadBalancerPoolMemberTargetIP +// - LoadBalancerPoolMemberTargetLoadBalancerReference +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 *Deleted `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"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the LoadBalancerPoolMemberTarget.ResourceType property. +// The resource type. +const ( + LoadBalancerPoolMemberTargetResourceTypeLoadBalancerConst = "load_balancer" +) + +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, 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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_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 +} + +// LoadBalancerPoolMemberTargetPrototype : The pool member target. +// +// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load balancer has a subnet in. +// +// 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. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +// - LoadBalancerPoolMemberTargetPrototypeIP +// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity +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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 `least_connections` algorithm is only supported for load balancers that have + // `availability` with value `subnet` in the profile. + Algorithm *string `json:"algorithm,omitempty"` + + // The failsafe policy for this load balancer pool. + FailsafePolicy *LoadBalancerPoolFailsafePolicyPatch `json:"failsafe_policy,omitempty"` + + // The health monitor of this pool. + // + // If this pool has a member targeting a load balancer then: + // + // - If the targeted load balancer has multiple subnets, this health monitor will be + // used to direct traffic to the available subnets. + // - The health checks spawned by this health monitor will be handled as any other + // traffic (that is, subject to the configuration of listeners and pools on the + // target load balancer). + // - This health monitor does not affect how pool member health is determined within + // the target load balancer. + // + // For more information, see [Private Path network load balancer frequently asked + // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). + 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 or a load balancer failsafe target pool, the specified + // protocol must match or be compatible with each other'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 + // + // For load balancers in the `network` family, this property must be `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. 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" + 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 or a load balancer failsafe target pool, the specified +// protocol must match or be compatible with each other'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 +// +// For load balancers in the `network` family, this property must be `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, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "failsafe_policy-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) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolPatch.Algorithm) { + _patch["algorithm"] = loadBalancerPoolPatch.Algorithm + } + if !core.IsNil(loadBalancerPoolPatch.FailsafePolicy) { + _patch["failsafe_policy"] = loadBalancerPoolPatch.FailsafePolicy.asPatch() + } + 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 +} + +// LoadBalancerPoolPrototypeLoadBalancerContext : LoadBalancerPoolPrototypeLoadBalancerContext struct +type LoadBalancerPoolPrototypeLoadBalancerContext struct { + // 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. + // + // If this pool has a member targeting a load balancer then: + // + // - If the targeted load balancer has multiple subnets, this health monitor will be + // used to direct traffic to the available subnets. + // - The health checks spawned by this health monitor will be handled as any other + // traffic (that is, subject to the configuration of listeners and pools on the target + // load balancer). + // - This health monitor does not affect how pool member health is determined within the + // target load balancer. + // + // For more information, see [Private Path network load balancer frequently asked + // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). + HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `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 + // + // 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 + // `source_ip_session_persistence_supported` set to `true` in its profile. + // + // If unspecified, session persistence will be disabled, and traffic will be distributed + // across members of the pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.Algorithm property. +// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have +// `availability` with value `subnet` in the profile. +const ( + LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.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 ( + LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPConst = "http" + LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPSConst = "https" + LoadBalancerPoolPrototypeLoadBalancerContextProtocolTCPConst = "tcp" + LoadBalancerPoolPrototypeLoadBalancerContextProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.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 +// +// For load balancers in the `network` family, this property must be `disabled`. +const ( + LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV1Const = "v1" + LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV2Const = "v2" +) + +// NewLoadBalancerPoolPrototypeLoadBalancerContext : Instantiate LoadBalancerPoolPrototypeLoadBalancerContext (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolPrototypeLoadBalancerContext(algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, protocol string) (_model *LoadBalancerPoolPrototypeLoadBalancerContext, err error) { + _model = &LoadBalancerPoolPrototypeLoadBalancerContext{ + 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 +} + +// UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerPoolPrototypeLoadBalancerContext from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPrototypeLoadBalancerContext) + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer pool. + 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct +type LoadBalancerPoolSessionPersistence struct { + // The session persistence cookie name. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence 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"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. +// The session persistence type. +// +// 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. 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. + // + // 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. +// +// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or +// `https`. +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 +} + +// 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. + // + // If specified, the session persistence type must be `app_cookie`. + CookieName *string `json:"cookie_name,omitempty"` + + // 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. +// +// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or +// `https`. +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 +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + AccessModes *LoadBalancerProfileAccessModes `json:"access_modes" validate:"required"` + + Availability LoadBalancerProfileAvailabilityIntf `json:"availability" validate:"required"` + + FailsafePolicyActions LoadBalancerProfileFailsafePolicyActionsIntf `json:"failsafe_policy_actions" validate:"required"` + + // 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"` + + SourceIPSessionPersistenceSupported LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf `json:"source_ip_session_persistence_supported" validate:"required"` + + // The load balancer profiles that load balancers with this profile can target. + TargetableLoadBalancerProfiles []LoadBalancerProfileReference `json:"targetable_load_balancer_profiles" 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.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.UnmarshalModel(m, "failsafe_policy_actions", &obj.FailsafePolicyActions, UnmarshalLoadBalancerProfileFailsafePolicyActions) + if err != nil { + err = core.SDKErrorf(err, "", "failsafe_policy_actions-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, "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, "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, "targetable_load_balancer_profiles", &obj.TargetableLoadBalancerProfiles, UnmarshalLoadBalancerProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "targetable_load_balancer_profiles-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 +} + +// 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. + 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 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, 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, 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 +} + +// LoadBalancerProfileFailsafePolicyActions : LoadBalancerProfileFailsafePolicyActions struct +// Models which "extend" this model: +// - LoadBalancerProfileFailsafePolicyActionsEnum +// - LoadBalancerProfileFailsafePolicyActionsDependent +type LoadBalancerProfileFailsafePolicyActions struct { + // The default failsafe policy action for this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The supported failsafe policy actions. + Values []string `json:"values,omitempty"` +} + +// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Default property. +// The default failsafe policy action for this profile. +const ( + LoadBalancerProfileFailsafePolicyActionsDefaultBypassConst = "bypass" + LoadBalancerProfileFailsafePolicyActionsDefaultDropConst = "drop" + LoadBalancerProfileFailsafePolicyActionsDefaultFailConst = "fail" + LoadBalancerProfileFailsafePolicyActionsDefaultForwardConst = "forward" +) + +// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileFailsafePolicyActionsTypeEnumConst = "enum" +) + +// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Values property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. +// - `drop`: Drops requests. +// - `fail`: Fails requests with an HTTP `503` status code. +// - `forward`: Forwards requests to the `target` pool. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerProfileFailsafePolicyActionsValuesBypassConst = "bypass" + LoadBalancerProfileFailsafePolicyActionsValuesDropConst = "drop" + LoadBalancerProfileFailsafePolicyActionsValuesFailConst = "fail" + LoadBalancerProfileFailsafePolicyActionsValuesForwardConst = "forward" +) + +func (*LoadBalancerProfileFailsafePolicyActions) isaLoadBalancerProfileFailsafePolicyActions() bool { + return true +} + +type LoadBalancerProfileFailsafePolicyActionsIntf interface { + isaLoadBalancerProfileFailsafePolicyActions() bool +} + +// UnmarshalLoadBalancerProfileFailsafePolicyActions unmarshals an instance of LoadBalancerProfileFailsafePolicyActions from the specified map of raw messages. +func UnmarshalLoadBalancerProfileFailsafePolicyActions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileFailsafePolicyActions) + 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 +} + +// 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 +} + +// 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 +// - 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 +} + +// 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. + 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, no traffic will be allowed. + 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // 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 + // except the last page. + Next *PageLink `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, 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, "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, 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 *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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLPatch.Name) { + _patch["name"] = networkACLPatch.Name + } + + 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 no traffic being allowed. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // The 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 *Deleted `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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRule : NetworkACLRule struct +// Models which "extend" this model: +// - NetworkACLRuleNetworkACLRuleProtocolAll +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +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 name of the network 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 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 ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of the TCP or UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of the TCP or UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + SourcePortMin *int64 `json:"source_port_min,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 name of the network protocol. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. +// 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 *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 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. + 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, 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, "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 +} + +// NetworkACLRuleItem : NetworkACLRuleItem struct +// Models which "extend" this model: +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +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 name of the network 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 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 ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of the TCP or UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of the TCP or UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + SourcePortMin *int64 `json:"source_port_min,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 name of the network protocol. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 the TCP or UDP destination port range. + // + // Must be larger than or equal to `destination_port_min`. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + // + // Must be smaller than or equal to `destination_port_max`. + 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 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 the TCP or UDP source port range. + // + // Must be larger than or equal to `source_port_min`. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + // + // Must be smaller than or equal to `source_port_max`. + 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" +) + +// 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, "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) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLRulePatch.Action) { + _patch["action"] = networkACLRulePatch.Action + } + 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.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 +} + +// NetworkACLRulePrototype : NetworkACLRulePrototype struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype +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 name of 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. + 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 ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, + // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, + // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of the TCP or UDP source port range. + // + // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + // + // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMin *int64 `json:"source_port_min,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 name of the network protocol. +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: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype +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 name of 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. + 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 ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, + // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, + // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of the TCP or UDP source port range. + // + // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + // + // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMin *int64 `json:"source_port_min,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 name of the network protocol. +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 *Deleted `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, 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 + } + 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"` + + // The primary IP address of this instance network interface. + 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 *Deleted `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 primary IP address of this bare metal server 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 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, 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, "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 +} + +// 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 *Deleted `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 primary IP address of this instance 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 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, 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, "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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(networkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = networkInterfacePatch.AllowIPSpoofing + } + if !core.IsNil(networkInterfacePatch.Name) { + _patch["name"] = networkInterfacePatch.Name + } + + 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 +} + +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // The network interfaces for the instance. + 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 { + // 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"` + + // 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 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"` + + // The major release version of this operating system. + 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()) + 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, "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()) + 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 *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 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, 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, "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 +} + +// 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 +} + +// 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. + 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. + 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 *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 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, 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, "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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(placementGroupPatch.Name) { + _patch["name"] = placementGroupPatch.Name + } + + 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 *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"` +} + +// 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, 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 *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 +} + +// 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) { + _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 *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 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, 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, "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 +} + +// 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 *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"` +} + +// 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(privatePathServiceGatewayPatch.DefaultAccessPolicy) { + _patch["default_access_policy"] = privatePathServiceGatewayPatch.DefaultAccessPolicy + } + 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 +} + +// 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. + 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 *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 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, 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, "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 +} + +// 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 *Deleted `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, 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 + } + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(publicGatewayPatch.Name) { + _patch["name"] = publicGatewayPatch.Name + } + + 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 *Deleted `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, 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 +} + +// 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. + 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. + // + // 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" +) + +// 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 { + // The regions for the account. + 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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 +} + +// 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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 bare metal server 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. + 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: + // - `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. + 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 [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"` + + // 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: +// - `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" +) + +// 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 [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 + // [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 [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 +// [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 +} + +// 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. + 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 *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 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, 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, "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 +} + +// ReservationCommittedUse : The committed use reservation configuration. +type ReservationCommittedUse struct { + // The expiration date and time for this committed use reservation. + // + // 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. + // - `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. + 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. +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 +} + +// 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. + 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. +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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 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`. + 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 [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()) + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationPatch.AffinityPolicy) { + _patch["affinity_policy"] = reservationPatch.AffinityPolicy + } + if !core.IsNil(reservationPatch.Capacity) { + _patch["capacity"] = reservationPatch.Capacity.asPatch() + } + 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 +} + +// 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,omitempty"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservationProfile.ResourceType property. +// The resource type. +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) + 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 [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"` + + // 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 ( + ReservationProfilePatchResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + 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 +} + +// 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 [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"` + + // 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 ( + ReservationProfilePrototypeResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + 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 *Deleted `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, 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 +} + +// 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. + // + // 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 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"` +} + +// 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. +// +// 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" +) + +// 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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of reserved IPs in the 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, 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, "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 *PageLink `json:"first" validate:"required"` + + // 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. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 +} + +// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct +type ReservedIPCollectionEndpointGatewayContext struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // 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. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 *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 +} + +// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct +type ReservedIPCollectionInstanceNetworkInterfaceContext struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // 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. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 *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 +} + +// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct +type ReservedIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + 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"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `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"` +} + +// 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, UnmarshalPageLink) + 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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(reservedIPPatch.AutoDelete) { + _patch["auto_delete"] = reservedIPPatch.AutoDelete + } + if !core.IsNil(reservedIPPatch.Name) { + _patch["name"] = reservedIPPatch.Name + } + + 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 *Deleted `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, 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 +} + +// 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 +// - 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 *Deleted `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, 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 +} + +// 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 +} + +// 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: +// - 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 +} + +// 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: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Action *string `json:"action" validate:"required"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Origin *string `json:"origin" validate:"required"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. + // + // If subnets are attached to the route's routing table, egress traffic from those + // subnets in this zone will be subject to this route. If this route's routing table + // has any of `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic + // from those ingress sources arriving in this zone will be subject to this route. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the 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 +// +// 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" + 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 *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 VPC 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 VPC default 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. +// Models which "extend" this model: +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this VPN gateway. + 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, 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 +} + +// 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this VPN gateway connection. + 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, 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 +} + +// 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. +// 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 URL for this VPN gateway connection. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { + return true +} + +type RouteNextHopPatchIntf interface { + isaRouteNextHopPatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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`. +// +// 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` + // 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 (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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(routePatch.Advertise) { + _patch["advertise"] = routePatch.Advertise + } + 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 +} + +// 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 (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. + NextHop RouteNextHopPrototypeIntf `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, UnmarshalRouteNextHopPrototype) + 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 +} + +// RouteReference : RouteReference struct +type RouteReference 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 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, 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 + } + 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. + // + // 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 + // 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 CRN for this VPC routing table. + CRN *string `json:"crn" 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 group for this routing table. + ResourceGroup *ResourceGroupReference `json:"resource_group" 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, "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, "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.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_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 *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 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, 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, "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 +} + +// 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"` + + // The URL for this routing table. + Href *string `json:"href,omitempty"` +} + +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} + +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool + asPatch() map[string]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()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the 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 + // `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) { + _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 !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 +} + +// 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"` + + // 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.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 +} + +// 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 CRN for this security group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this security group. + 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, no traffic will be allowed. + 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 *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 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, 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, "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 +} + +// 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 CRN for this security group. + CRN *string `json:"crn,omitempty"` + + // The URL for this security group. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupPatch.Name) { + _patch["name"] = securityGroupPatch.Name + } + + return +} + +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this security group. + 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, 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 + } + 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 allow. + 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 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 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 name of the network 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 + // 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 the TCP or UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to allow. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRule.Protocol property. +// The name of the network 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" + 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 : SecurityGroupRuleCollection struct +type SecurityGroupRuleCollection struct { + // The rules for the security group. + 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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). +// +// 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 allow. + Direction *string `json:"direction,omitempty"` + + // 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 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 allow. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// 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 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) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRulePatch.Code) { + _patch["code"] = securityGroupRulePatch.Code + } + 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 +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to allow. + Direction *string `json:"direction" validate:"required"` + + // 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 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 name of the network 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 + // 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 the TCP or 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 the TCP or 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 allow. +const ( + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototype.Protocol property. +// The name of the network protocol to allow. +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) { + obj := new(SecurityGroupRulePrototype) + 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, "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 +} + +// 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 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this security group. + 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, 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 + } + 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 CRN for this security group. + CRN *string `json:"crn,omitempty"` + + // The URL for this security group. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. +// +// 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 CRN for this security group. + CRN *string `json:"crn,omitempty"` + + // The URL for this security group. + 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 *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 targets for the 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, 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, "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 +} + +// 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: +// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceLoadBalancerReference +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference +// - SecurityGroupTargetReferenceVPNServerReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this bare metal server 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 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 name for this bare metal server network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this endpoint gateway. + 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, 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 + } + 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 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 and its snapshots. + AccessorBindings []ShareAccessorBindingReference `json:"accessor_bindings" validate:"required"` + + // The access protocols to allow for this share: + // - `nfs4`: NFSv4 is used to access this share via its associated share mount target. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AllowedAccessProtocols []string `json:"allowed_access_protocols" validate:"required"` + + // The transit encryption modes allowed for this share: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. + // - `stunnel`: Encrypted in transit using a connection via the installed stunnel + // client. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes" validate:"required"` + + // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: + // - `zonal`: The share's data will be available provided the `zone` of the share is + // available. Additionally, disasters affecting the zone may lead to data loss. + // - `regional`: The share's data will be available provided at least one zone in the + // region is available. Additionally, disasters affecting the entire region may lead + // to data loss. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AvailabilityMode *string `json:"availability_mode" validate:"required"` + + // The maximum bandwidth (in megabits per second) for the share. + Bandwidth *int64 `json:"bandwidth" 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) + // ](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for the file share. + // + // The maximum IOPS for a share as defined by the share's profile 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 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"` + + // 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 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"` + + // 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 (in gigabytes), excluding share snapshots. + 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"` + + // The [storage + // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): + // - `1`: The first storage generation + // - `2`: The second storage generation + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + StorageGeneration *int64 `json:"storage_generation" validate:"required"` + + // Tags for this resource. + UserTags []string `json:"user_tags" validate:"required"` + + // The zone this file share resides in. + Zone *ZoneReference `json:"zone,omitempty"` +} + +// 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.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.AllowedAccessProtocols property. +const ( + ShareAllowedAccessProtocolsNfs4Const = "nfs4" +) + +// Constants associated with the Share.AllowedTransitEncryptionModes property. +const ( + ShareAllowedTransitEncryptionModesIpsecConst = "ipsec" + ShareAllowedTransitEncryptionModesNoneConst = "none" + ShareAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// Constants associated with the Share.AvailabilityMode property. +// The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: +// - `zonal`: The share's data will be available provided the `zone` of the share is +// available. Additionally, disasters affecting the zone may lead to data loss. +// - `regional`: The share's data will be available provided at least one zone in the +// region is available. Additionally, disasters affecting the entire region may lead +// to data loss. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareAvailabilityModeRegionalConst = "regional" + ShareAvailabilityModeZonalConst = "zonal" +) + +// 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, "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_access_protocols", &obj.AllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "availability_mode", &obj.AvailabilityMode) + if err != nil { + err = core.SDKErrorf(err, "", "availability_mode-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, "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.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()) + 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, "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()) + 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.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, "storage_generation", &obj.StorageGeneration) + if err != nil { + err = core.SDKErrorf(err, "", "storage_generation-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 +} + +// ShareAccessorBinding : ShareAccessorBinding struct +type ShareAccessorBinding struct { + // The accessor for this share accessor binding. + 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. +// 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 *Deleted `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, 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 +} + +// ShareAccessorBindingCollection : ShareAccessorBindingCollection struct +type ShareAccessorBindingCollection struct { + // A page of accessor bindings for the share. + AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" 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"` +} + +// 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, 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 *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 +} + +// 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. + 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 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, 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, "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 +} + +// 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 +} + +// 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: + // + // - `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 protocol used to access the share for this share mount target: + // - `nfs4`: NFSv4 will be used. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AccessProtocol *string `json:"access_protocol" 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. + // - `ipsec`: Encrypted in transit using an instance identity certificate. + // - `stunnel`: Encrypted in transit using a connection via the installed stunnel + // client. + // + // 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.AccessProtocol property. +// The protocol used to access the share for this share mount target: +// - `nfs4`: NFSv4 will be used. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareMountTargetAccessProtocolNfs4Const = "nfs4" +) + +// 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. +// - `ipsec`: Encrypted in transit using an instance identity certificate. +// - `stunnel`: Encrypted in transit using a connection via the installed stunnel +// client. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareMountTargetTransitEncryptionIpsecConst = "ipsec" + ShareMountTargetTransitEncryptionNoneConst = "none" + ShareMountTargetTransitEncryptionStunnelConst = "stunnel" +) + +// 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, "access_protocol", &obj.AccessProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "access_protocol-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 *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // 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 + // except the last page. + Next *PageLink `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, 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, "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, 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 *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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(shareMountTargetPatch.Name) { + _patch["name"] = shareMountTargetPatch.Name + } + + return +} + +// ShareMountTargetPrototype : ShareMountTargetPrototype struct +// Models which "extend" this model: +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC +type ShareMountTargetPrototype struct { + // The protocol to use to access the share for this share mount target: + // - `nfs4`: NFSv4 will be used. + // + // The specified value must be listed in the share's `allowed_access_protocols`. + AccessProtocol *string `json:"access_protocol" validate:"required"` + + // The name for this share mount target. The name must not be used by another mount target for the file share. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` + + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc,omitempty"` +} + +// Constants associated with the ShareMountTargetPrototype.AccessProtocol property. +// The protocol to use to access the share for this share mount target: +// - `nfs4`: NFSv4 will be used. +// +// The specified value must be listed in the share's `allowed_access_protocols`. +const ( + ShareMountTargetPrototypeAccessProtocolNfs4Const = "nfs4" +) + +// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `ipsec`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( + ShareMountTargetPrototypeTransitEncryptionIpsecConst = "ipsec" + ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeTransitEncryptionStunnelConst = "stunnel" +) + +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, "access_protocol", &obj.AccessProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) + return + } + 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 *Deleted `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, 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 +} + +// 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 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"` + + // 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"` +} + +// 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" + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled" +) + +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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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, + // `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The access protocols to allow for this share (replacing any existing access protocols). + // + // If the share has existing mount targets, the set of allowed access protocols must contain all `access_protocol` + // modes specified by existing mount targets. + AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` + + // The transit encryption modes to allow for this share + // (replacing the existing allowed transit encryption modes). The specified transit encryption modes must contain all + // transit_encryption modes specified by existing mount targets. + // + // For this property to be updated, the `accessor_binding_role` must be `none`. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + + // The maximum bandwidth (in megabits per second) for the share. + // + // If specified, the share profile must not have a `bandwidth.type` of `dependent` or + // `fixed`, and the specified value must be within the `bandwidth` range of the share's profile. + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. + // + // 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`, the share profile must not have an `iops.type` of `dependent` or + // `fixed`, and the specified value must be within the `iops` range of the share's profile supported by the share's + // size. + 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 every 15 minutes. + // + // 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 (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` + // - 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. + 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, +// `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. +const ( + SharePatchAccessControlModeSecurityGroupConst = "security_group" + SharePatchAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the SharePatch.AllowedAccessProtocols property. +const ( + SharePatchAllowedAccessProtocolsNfs4Const = "nfs4" +) + +// Constants associated with the SharePatch.AllowedTransitEncryptionModes property. +const ( + SharePatchAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePatchAllowedTransitEncryptionModesNoneConst = "none" + SharePatchAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// 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, "allowed_access_protocols", &obj.AllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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) { + _patch = map[string]interface{}{} + if !core.IsNil(sharePatch.AccessControlMode) { + _patch["access_control_mode"] = sharePatch.AccessControlMode + } + if !core.IsNil(sharePatch.AllowedAccessProtocols) { + _patch["allowed_access_protocols"] = sharePatch.AllowedAccessProtocols + } + if !core.IsNil(sharePatch.AllowedTransitEncryptionModes) { + _patch["allowed_transit_encryption_modes"] = sharePatch.AllowedTransitEncryptionModes + } + if !core.IsNil(sharePatch.Bandwidth) { + _patch["bandwidth"] = sharePatch.Bandwidth + } + 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 +} + +// ShareProfile : ShareProfile struct +type ShareProfile struct { + // The possible allowed access protocols for a share with this profile. + AllowedAccessProtocols ShareProfileAllowedAccessProtocolsIntf `json:"allowed_access_protocols" validate:"required"` + + // The possible allowed transit encryption modes for a share with this profile. + AllowedTransitEncryptionModes ShareProfileAllowedTransitEncryptionModesIntf `json:"allowed_transit_encryption_modes" validate:"required"` + + // The data availability mode of a share with this profile. + AvailabilityModes ShareProfileAvailabilityModesIntf `json:"availability_modes" validate:"required"` + + // The permitted bandwidth (in megabits per second) for a share with this profile. + Bandwidth ShareProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // 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. + // + // 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. + 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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, "allowed_access_protocols", &obj.AllowedAccessProtocols, UnmarshalShareProfileAllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes, UnmarshalShareProfileAllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "availability_modes", &obj.AvailabilityModes, UnmarshalShareProfileAvailabilityModes) + if err != nil { + err = core.SDKErrorf(err, "", "availability_modes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalShareProfileBandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + return + } + 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 +} + +// ShareProfileAllowedAccessProtocols : ShareProfileAllowedAccessProtocols struct +// Models which "extend" this model: +// - ShareProfileAllowedAccessProtocolsSubset +type ShareProfileAllowedAccessProtocols struct { + // The default allowed access protocol modes for shares with this profile. + Default []string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The possible allowed access protocols for shares with this profile: + // - `nfs4`: NFSv4 will be used. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values,omitempty"` +} + +// Constants associated with the ShareProfileAllowedAccessProtocols.Default property. +const ( + ShareProfileAllowedAccessProtocolsDefaultNfs4Const = "nfs4" +) + +// Constants associated with the ShareProfileAllowedAccessProtocols.Type property. +// The type for this profile field. +const ( + ShareProfileAllowedAccessProtocolsTypeSubsetConst = "subset" +) + +// Constants associated with the ShareProfileAllowedAccessProtocols.Values property. +const ( + ShareProfileAllowedAccessProtocolsValuesNfs4Const = "nfs4" +) + +func (*ShareProfileAllowedAccessProtocols) isaShareProfileAllowedAccessProtocols() bool { + return true +} + +type ShareProfileAllowedAccessProtocolsIntf interface { + isaShareProfileAllowedAccessProtocols() bool +} + +// UnmarshalShareProfileAllowedAccessProtocols unmarshals an instance of ShareProfileAllowedAccessProtocols from the specified map of raw messages. +func UnmarshalShareProfileAllowedAccessProtocols(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAllowedAccessProtocols) + 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 +} + +// ShareProfileAllowedTransitEncryptionModes : ShareProfileAllowedTransitEncryptionModes struct +// Models which "extend" this model: +// - ShareProfileAllowedTransitEncryptionModesSubset +type ShareProfileAllowedTransitEncryptionModes struct { + // The default allowed transit encryption modes for shares with this profile. + Default []string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The allowed [transit encryption modes](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for a share with this profile: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. + // - `stunnel`: Encrypted in transit using a connection via an stunnel connection. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values,omitempty"` +} + +// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Default property. +const ( + ShareProfileAllowedTransitEncryptionModesDefaultIpsecConst = "ipsec" + ShareProfileAllowedTransitEncryptionModesDefaultNoneConst = "none" + ShareProfileAllowedTransitEncryptionModesDefaultStunnelConst = "stunnel" +) + +// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Type property. +// The type for this profile field. +const ( + ShareProfileAllowedTransitEncryptionModesTypeSubsetConst = "subset" +) + +// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Values property. +const ( + ShareProfileAllowedTransitEncryptionModesValuesIpsecConst = "ipsec" + ShareProfileAllowedTransitEncryptionModesValuesNoneConst = "none" + ShareProfileAllowedTransitEncryptionModesValuesStunnelConst = "stunnel" +) + +func (*ShareProfileAllowedTransitEncryptionModes) isaShareProfileAllowedTransitEncryptionModes() bool { + return true +} + +type ShareProfileAllowedTransitEncryptionModesIntf interface { + isaShareProfileAllowedTransitEncryptionModes() bool +} + +// UnmarshalShareProfileAllowedTransitEncryptionModes unmarshals an instance of ShareProfileAllowedTransitEncryptionModes from the specified map of raw messages. +func UnmarshalShareProfileAllowedTransitEncryptionModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAllowedTransitEncryptionModes) + 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 +} + +// ShareProfileAvailabilityModes : ShareProfileAvailabilityModes struct +// Models which "extend" this model: +// - ShareProfileAvailabilityModesEnum +// - ShareProfileAvailabilityModesFixed +type ShareProfileAvailabilityModes struct { + // The default data availability mode for this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: + // - `zonal`: The data availability of this share is limited only to a single zone of a + // given region as provided by the `zone` of the share. + // - `regional`: The data availability of this share covers all zones in the region where + // the share is created. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values,omitempty"` + + // The value for this profile field. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the ShareProfileAvailabilityModes.Default property. +// The default data availability mode for this profile. +const ( + ShareProfileAvailabilityModesDefaultRegionalConst = "regional" + ShareProfileAvailabilityModesDefaultZonalConst = "zonal" +) + +// Constants associated with the ShareProfileAvailabilityModes.Type property. +// The type for this profile field. +const ( + ShareProfileAvailabilityModesTypeEnumConst = "enum" +) + +// Constants associated with the ShareProfileAvailabilityModes.Values property. +const ( + ShareProfileAvailabilityModesValuesRegionalConst = "regional" + ShareProfileAvailabilityModesValuesZonalConst = "zonal" +) + +// Constants associated with the ShareProfileAvailabilityModes.Value property. +// The value for this profile field. +const ( + ShareProfileAvailabilityModesValueRegionalConst = "regional" + ShareProfileAvailabilityModesValueZonalConst = "zonal" +) + +func (*ShareProfileAvailabilityModes) isaShareProfileAvailabilityModes() bool { + return true +} + +type ShareProfileAvailabilityModesIntf interface { + isaShareProfileAvailabilityModes() bool +} + +// UnmarshalShareProfileAvailabilityModes unmarshals an instance of ShareProfileAvailabilityModes from the specified map of raw messages. +func UnmarshalShareProfileAvailabilityModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAvailabilityModes) + 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 + } + 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 +} + +// ShareProfileBandwidth : ShareProfileBandwidth struct +// Models which "extend" this model: +// - ShareProfileBandwidthRange +// - ShareProfileBandwidthDependent +// - ShareProfileBandwidthFixed +// - ShareProfileBandwidthEnum +// - ShareProfileBandwidthDependentRange +type ShareProfileBandwidth struct { + // 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 type for this profile field. + Type *string `json:"type,omitempty"` + + Value *int64 `json:"value,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the ShareProfileBandwidth.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthTypeRangeConst = "range" +) + +func (*ShareProfileBandwidth) isaShareProfileBandwidth() bool { + return true +} + +type ShareProfileBandwidthIntf interface { + isaShareProfileBandwidth() bool +} + +// UnmarshalShareProfileBandwidth unmarshals an instance of ShareProfileBandwidth from the specified map of raw messages. +func UnmarshalShareProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidth) + 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 + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacity : ShareProfileCapacity struct +// Models which "extend" this model: +// - ShareProfileCapacityFixed +// - ShareProfileCapacityEnum +// - ShareProfileCapacityRange +// - 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 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"` + + // 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"` +} + +// 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, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + 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 +} + +// ShareProfileCollection : ShareProfileCollection struct +type ShareProfileCollection 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 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, 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, 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 +} + +// ShareProfileIops : ShareProfileIops struct +// Models which "extend" this model: +// - ShareProfileIopsFixed +// - ShareProfileIopsRange +// - ShareProfileIopsEnum +// - ShareProfileIopsDependentRange +// - ShareProfileIopsDependent +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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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 +// - SharePrototypeShareByOriginShare +// - SharePrototypeShareBySourceSnapshot +type SharePrototype struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + 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"` + + // 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. + // + // Replica file shares can only be created for shares with an `availability_mode` of + // `zonal`. + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // 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 access protocols to allow for this share. If unspecified: + // - If share mount targets are specified, only the access protocols specified by those + // share mount target will be allowed. + // - Otherwise, the default access protocols from the profile will be used. + AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` + + // The maximum bandwidth (in megabits per second) for the file share. + // + // If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this property is system-managed and must not + // be specified. Otherwise, the specified value must be within the `bandwidth` range of the share's profile. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `size` and `iops`](https://cloud.ibm.com/docs/vpc?topic=_TBD_). + Bandwidth *int64 `json:"bandwidth,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 maximum input/output operations per second (IOPS) for the file share. + // + // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be + // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the + // share's specified size. + 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"` + + // The size of the file share (in gigabytes), excluding share snapshots. + // + // The specified value must be within the permitted `capacity` range of the share's profile and supported by the + // share's specified IOPS. + Size *int64 `json:"size,omitempty"` + + // 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. + // + // This property must not be specified if the `availability_mode` of the profile for the + // share is `regional`. + 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 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 + // 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"` + + // 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"` + + // 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. +const ( + SharePrototypeAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// 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" +) + +// Constants associated with the SharePrototype.AllowedAccessProtocols property. +const ( + SharePrototypeAllowedAccessProtocolsNfs4Const = "nfs4" +) + +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, "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.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, "allowed_access_protocols", &obj.AllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "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, "", "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.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()) + 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, "origin_share", &obj.OriginShare, UnmarshalShareIdentity) + if err != nil { + 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 +} + +// 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. +// +// Replica file shares can only be created for shares with an `availability_mode` of +// `zonal`. +type SharePrototypeShareContext struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. + // + // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be + // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the + // share's specified size. + 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 every 15 minutes. + 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. 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"` +} + +// Constants associated with the SharePrototypeShareContext.AllowedTransitEncryptionModes property. +const ( + SharePrototypeShareContextAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeShareContextAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareContextAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string) (_model *SharePrototypeShareContext, err error) { + _model = &SharePrototypeShareContext{ + Profile: profile, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + } + 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, "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()) + 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 *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 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, 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 +} + +// 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"` +} + +// 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()) + 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 +} + +// 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. For shares with `availability_mode` of + // `regional`, this property will be absent. + Zone *ShareSnapshotZone `json:"zone,omitempty"` +} + +// 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, UnmarshalShareSnapshotZone) + 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 +} + +// ShareSnapshotZone : The zone this share snapshot resides in. For shares with `availability_mode` of +// `regional`, this property will be absent. +type ShareSnapshotZone 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"` +} + +// UnmarshalShareSnapshotZone unmarshals an instance of ShareSnapshotZone from the specified map of raw messages. +func UnmarshalShareSnapshotZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshotZone) + 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 +} + +// 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. + 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 [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"` + + // 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"` + + // 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"` + + // 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 [storage + // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): + // - `1`: The first storage generation + // - `2`: The second storage generation + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + StorageGeneration *int64 `json:"storage_generation" 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" + SnapshotLifecycleStateUnusableConst = "unusable" + 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, "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()) + 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.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()) + 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, "storage_generation", &obj.StorageGeneration) + if err != nil { + err = core.SDKErrorf(err, "", "storage_generation-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 +} + +// 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. + 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 { + // The clones for the snapshot. + 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 *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 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, 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, 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 +} + +// 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 *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 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, 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, "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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete) { + _patch["delete_snapshots_on_delete"] = snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete + } + if !core.IsNil(snapshotConsistencyGroupPatch.Name) { + _patch["name"] = snapshotConsistencyGroupPatch.Name + } + + 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(snapshotPatch.Name) { + _patch["name"] = snapshotPatch.Name + } + if !core.IsNil(snapshotPatch.UserTags) { + _patch["user_tags"] = snapshotPatch.UserTags + } + + 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 *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 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, 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 +} + +// 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"` +} + +// 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()) + 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 *Deleted `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, 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 +} + +// 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. + // + // 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. + // + // 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. +// +// 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" + 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 *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. + 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, 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, "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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetPatch.Name) { + _patch["name"] = subnetPatch.Name + } + 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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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 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, 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 +} + +// TrustedProfileIdentity : Identifies a trusted profile by a unique property. +// Models which "extend" this model: +// - TrustedProfileIdentityByID +// - TrustedProfileIdentityByCRN +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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + 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 +} + +// 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. + 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 file 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 +} + +// 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. + 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 +} + +// UpdateVPCRouteResponse : UpdateVPCRouteResponse struct +type UpdateVPCRouteResponse struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to system-provided routes + // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Action *string `json:"action" validate:"required"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If present, the resource that created the route. Routes with this property present cannot + // be directly deleted. All routes with an `origin` of `service` will have this property set, + // and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Origin *string `json:"origin" validate:"required"` + + // The priority of this route. Smaller values have higher priority. + // + // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest + // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is + // distributed between them. + Priority *int64 `json:"priority" validate:"required"` + + // The zone the route applies to. + // + // If subnets are attached to the route's routing table, egress traffic from those + // subnets in this zone will be subject to this route. If this route's routing table + // has any of `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic + // from those ingress sources arriving in this zone will be subject to this route. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the UpdateVPCRouteResponse.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to system-provided routes +// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + UpdateVPCRouteResponseActionDelegateConst = "delegate" + UpdateVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" + UpdateVPCRouteResponseActionDeliverConst = "deliver" + UpdateVPCRouteResponseActionDropConst = "drop" +) + +// Constants associated with the UpdateVPCRouteResponse.LifecycleState property. +// The lifecycle state of the route. +const ( + UpdateVPCRouteResponseLifecycleStateDeletingConst = "deleting" + UpdateVPCRouteResponseLifecycleStateFailedConst = "failed" + UpdateVPCRouteResponseLifecycleStatePendingConst = "pending" + UpdateVPCRouteResponseLifecycleStateStableConst = "stable" + UpdateVPCRouteResponseLifecycleStateSuspendedConst = "suspended" + UpdateVPCRouteResponseLifecycleStateUpdatingConst = "updating" + UpdateVPCRouteResponseLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the UpdateVPCRouteResponse.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 ( + UpdateVPCRouteResponseOriginServiceConst = "service" + UpdateVPCRouteResponseOriginUserConst = "user" +) + +// UnmarshalUpdateVPCRouteResponse unmarshals an instance of UpdateVPCRouteResponse from the specified map of raw messages. +func UnmarshalUpdateVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UpdateVPCRouteResponse) + 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 +} + +// 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. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// Constants associated with the Vcpu.Architecture property. +// The VCPU architecture. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VcpuArchitectureAmd64Const = "amd64" + VcpuArchitectureS390xConst = "s390x" +) + +// Constants associated with the Vcpu.Manufacturer property. +// The VCPU manufacturer. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VcpuManufacturerAmdConst = "amd" + VcpuManufacturerIBMConst = "ibm" + VcpuManufacturerIntelConst = "intel" +) + +// 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/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. + 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. + // + // 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 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. +// +// 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" + 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 { + // 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. + 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 *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"` + + // A page 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, 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 + } + 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 +} + +// 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 +} + +// 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, +// 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 { + // 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. + 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"` +} + +// 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, 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 *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) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolutionBindingPatch.Name) { + _patch["name"] = vpcdnsResolutionBindingPatch.Name + } + + 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` + // + // 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. + // + // - `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. + // + // 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. + // + // 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. + // + // 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. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `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 + // - 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. +// +// 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" + 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. Applies 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 +} + +// 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 +// - 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcPatch.Dns) { + _patch["dns"] = vpcPatch.Dns.asPatch() + } + if !core.IsNil(vpcPatch.Name) { + _patch["name"] = vpcPatch.Name + } + + 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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, 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 +} + +// 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: +// - VPNGatewayPolicyMode +// - VPNGatewayRouteMode +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 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"` + + // 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. + 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,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. +// Policy mode VPN gateway. +const ( + VPNGatewayModePolicyConst = "policy" +) + +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 *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"` + + // A page 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, 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 + } + 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 +} + +// 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. + // + // 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. + 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 URL for this VPN gateway connection. + 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. + // + // 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. + 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"` + + // 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"` + + // 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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. +// +// 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" +) + +// 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, 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()) + } + 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 : VPNGatewayConnectionCollection struct +type VPNGatewayConnectionCollection struct { + // A page of connections for the VPN gateway. + Connections []VPNGatewayConnectionIntf `json:"connections" 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"` +} + +// 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 + } + 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 *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 +} + +// 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 +} + +// 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. + 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 URL for this IKE policy. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPatchIntf interface { + isaVPNGatewayConnectionIkePolicyPatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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: +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPrototype struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The URL for this IKE policy. + 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 URL for this IPsec policy. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPatchIntf interface { + isaVPNGatewayConnectionIPsecPolicyPatch() bool + asPatch() map[string]interface{} +} + +// 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 +} + +// 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: +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPrototype struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The URL for this IPsec policy. + 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"` + + // 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. + // - `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"` +} + +// 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" +) + +// 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, "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()) + 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 + } + 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) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPatch.AdminStateUp) { + _patch["admin_state_up"] = vpnGatewayConnectionPatch.AdminStateUp + } + 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 +} + +// 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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"` + + // 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"` + + // 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.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()) + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this VPN gateway connection. + 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, 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 +} + +// 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. + // + // 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 []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` +} + +// 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" +) + +// 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. + // + // 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"` +} + +// 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. +// +// 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" +) + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayPatch.Name) { + _patch["name"] = vpnGatewayPatch.Name + } + + 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 +} + +// 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 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. + 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 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" +) + +// 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. + // + // 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. + 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. +// +// 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" +) + +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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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 +// - 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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`. + 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 { + // A page of clients of the VPN server. + Clients []VPNServerClient `json:"clients" 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"` +} + +// 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, 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 *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 +} + +// VPNServerCollection : VPNServerCollection struct +type VPNServerCollection 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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // A page 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, 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 + } + 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 +} + +// 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 to use for 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 to use for 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) { + _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 !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 +} + +// 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 *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 for the VPN server. + 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, 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, 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 +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerRoutePatch.Name) { + _patch["name"] = vpnServerRoutePatch.Name + } + + 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 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"` + + // 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.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 ( + 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.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()) + 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 *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"` + + // A page 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, 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 + } + 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 +} + +// 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"` + + // 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. + ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"` +} + +// Constants associated with the VirtualNetworkInterfacePatch.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 +// +// 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. +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) + 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 + } + 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 +} + +// AsPatch returns a generic map representation of the VirtualNetworkInterfacePatch +func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(virtualNetworkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = virtualNetworkInterfacePatch.AllowIPSpoofing + } + 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 +} + +// 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 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) + // - `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. + // + // If the volume profile has a `bandwidth.type` of `dependent`, 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 + // 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 [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"` + + // 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 [storage + // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): + // - `1`: The first storage generation + // - `2`: The second storage generation + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + StorageGeneration *int64 `json:"storage_generation" 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.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 +// - `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, "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()) + 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.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()) + 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, "storage_generation", &obj.StorageGeneration) + if err != nil { + err = core.SDKErrorf(err, "", "storage_generation-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. + // + // 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. + // + // 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. +// +// 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" + VolumeAttachmentStatusDeletingConst = "deleting" + VolumeAttachmentStatusDetachingConst = "detaching" +) + +// 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" +) + +// 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 { + // The volume attachments for the instance. + 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" validate:"required"` +} + +// 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) { + _patch = map[string]interface{}{} + if !core.IsNil(volumeAttachmentPatch.DeleteVolumeOnInstanceDelete) { + _patch["delete_volume_on_instance_delete"] = volumeAttachmentPatch.DeleteVolumeOnInstanceDelete + } + if !core.IsNil(volumeAttachmentPatch.Name) { + _patch["name"] = volumeAttachmentPatch.Name + } + + 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"` + + // 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"` +} + +// 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 unattached volume. + 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 : 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 +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 bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // 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. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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 *Deleted `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, UnmarshalDeleted) + 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 +} + +// 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 *Deleted `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. + // + // 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" +) + +// 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, UnmarshalDeleted) + 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 +} + +// 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. + 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"` + + // A page 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, 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 + } + 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 +} + +// 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" + VolumeHealthReasonCodeThrottledByInsufficientInstanceBandwidthConst = "throttled_by_insufficient_instance_bandwidth" +) + +// 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 maximum bandwidth (in megabits per second) for the volume. + // + // If specified, the volume profile must not have a `bandwidth.type` of `dependent`. + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // 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. 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 have the same + // `family` and `storage_generation` values 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 (replacing any + // existing tags). + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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, "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) { + _patch = map[string]interface{}{} + if !core.IsNil(volumePatch.Bandwidth) { + _patch["bandwidth"] = volumePatch.Bandwidth + } + if !core.IsNil(volumePatch.Capacity) { + _patch["capacity"] = volumePatch.Capacity + } + 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 +} + +// VolumeProfile : VolumeProfile struct +type VolumeProfile struct { + AdjustableCapacityStates *VolumeProfileAdjustableCapacityStates `json:"adjustable_capacity_states" validate:"required"` + + AdjustableIopsStates *VolumeProfileAdjustableIopsStates `json:"adjustable_iops_states" validate:"required"` + + Bandwidth VolumeProfileBandwidthIntf `json:"bandwidth" 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 + // [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"` + + Iops VolumeProfileIopsIntf `json:"iops" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` + + // The storage generation value of volumes of this profile. + StorageGeneration *VolumeProfileStorageGenerationFixed `json:"storage_generation" 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" + 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, "bandwidth", &obj.Bandwidth, UnmarshalVolumeProfileBandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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()) + 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, 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()) + return + } + err = core.UnmarshalModel(m, "storage_generation", &obj.StorageGeneration, UnmarshalVolumeProfileStorageGenerationFixed) + if err != nil { + err = core.SDKErrorf(err, "", "storage_generation-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 +} + +// VolumeProfileBandwidth : VolumeProfileBandwidth struct +// Models which "extend" this model: +// - VolumeProfileBandwidthFixed +// - VolumeProfileBandwidthRange +// - VolumeProfileBandwidthEnum +// - VolumeProfileBandwidthDependentRange +// - VolumeProfileBandwidthDependent +type VolumeProfileBandwidth 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 VolumeProfileBandwidth.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthTypeFixedConst = "fixed" +) + +func (*VolumeProfileBandwidth) isaVolumeProfileBandwidth() bool { + return true +} + +type VolumeProfileBandwidthIntf interface { + isaVolumeProfileBandwidth() bool +} + +// UnmarshalVolumeProfileBandwidth unmarshals an instance of VolumeProfileBandwidth from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidth) + 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 +} + +// 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. + 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 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, 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, 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 +} + +// 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 +// - 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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 +} + +// VolumeProfileStorageGenerationFixed : The storage generation value of volumes of this profile. +type VolumeProfileStorageGenerationFixed 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 VolumeProfileStorageGenerationFixed.Type property. +// The type for this profile field. +const ( + VolumeProfileStorageGenerationFixedTypeFixedConst = "fixed" +) + +// UnmarshalVolumeProfileStorageGenerationFixed unmarshals an instance of VolumeProfileStorageGenerationFixed from the specified map of raw messages. +func UnmarshalVolumeProfileStorageGenerationFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileStorageGenerationFixed) + 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 +} + +// VolumePrototype : VolumePrototype struct +// Models which "extend" this model: +// - VolumePrototypeVolumeByCapacity +// - VolumePrototypeVolumeBySourceSnapshot +type VolumePrototype struct { + // The maximum bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // 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. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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.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 maximum bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // 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"` + + // 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. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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.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 maximum bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // 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. + // + // 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. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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.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 *Deleted `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, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 *Deleted `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, 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 +} + +// 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 +} + +// 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"` + + // 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 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 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()) + 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 + } + 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 +} + +// ZoneCollection : ZoneCollection struct +type ZoneCollection struct { + // The zones for the region. + 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 + asPatch() map[string]interface{} +} + +// 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 +} + +// 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. + 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 +} + +// 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 { + // 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 *Deleted `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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + // 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 *Deleted `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, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href" 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, 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 +} + +// 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. + // + // 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. + 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. +// +// 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" +) + +// 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. + // + // 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. + 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. +// +// 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" +) + +// 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 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"` + + // 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"` +} + +// 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 +} + +// 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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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 empty. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the + // attached virtual network interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding + // network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the port speed is that of its + // corresponding network attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of this bare metal server network interface. + 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 empty. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the + // attached virtual network interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding + // network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the port speed is that of its + // corresponding network attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of this bare metal server network interface. + 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 empty. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the + // attached virtual network interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding + // network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the port speed is that of its + // corresponding network attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of this bare metal server network interface. + 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 { + // 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"` + + ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + 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, "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, "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()) + 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 { + // 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"` + + ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + 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, "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, "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()) + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + 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 +} + +// 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 { + // 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 +} + +// 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 +// - 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 +} + +// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype : EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct { + // The CRN for this private path service gateway. + 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 EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype.ResourceType property. +// The target resource type for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" +) + +// 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 (*EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// 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 +} + +// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTargetPrototype +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" validate:"required"` + + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype.ResourceType property. +// The target resource type for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// 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 +} + +// 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"` +} + +// Constants associated with the EndpointGatewayTargetPrivatePathServiceGatewayReference.ResourceType property. +// The resource type. +const ( + EndpointGatewayTargetPrivatePathServiceGatewayReferenceResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" +) + +func (*EndpointGatewayTargetPrivatePathServiceGatewayReference) isaEndpointGatewayTarget() bool { + return true +} + +// 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, "", "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, 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 +} + +// 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 +} + +// 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 +// - 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 +} + +// 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 +// - 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 +} + +// 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 +// - 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 *Deleted `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 primary IP address of this bare metal server network interface. + 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, 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, "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 *Deleted `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 primary IP address of this instance network interface. + 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, 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, "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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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, "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 *Deleted `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"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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, 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, "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.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 +} + +// 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 *Deleted `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, 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 + } + 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 { + // 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"` +} + +// 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, "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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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. + 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, "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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 +// - 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. + 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. + 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 + // + // 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. + 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 +// +// 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" + 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 + // + // 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 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 enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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 *Deleted `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, 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, "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 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"` + + // 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"` +} + +// 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 +} + +// 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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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 +} + +// 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 { + // 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 +} + +// 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 +// - 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 +} + +// 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 +// - 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 +} + +// 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 +// - 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 +} + +// 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 { + // 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByCatalogOfferingConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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. +// +// The image's `user_data_format` must be `cloud_init`. +// 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByImageConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceBySourceSnapshotConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceBySourceTemplateConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByVolumeConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +// - 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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. +// +// The image's `user_data_format` must be `cloud_init`. +// 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByImageConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotConfidentialComputeModeTdxConst = "tdx" +) + +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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateBySourceTemplateConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByImageInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 CRN for this load balancer. + 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 +} + +// 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 { + // The URL for this load balancer. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The URL for this load balancer pool. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The URL for this load balancer listener. + 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 +} + +// 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 { + // 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 +} + +// 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 +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer listener. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity +func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.ID) { + _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.ID + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.Href) { + _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.Href + } + + 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"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + 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 +} + +// 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 { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // 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"` +} + +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 +} + +// 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 +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer pool. + 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 +} + +// 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 +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id,omitempty"` + + // The URL for this load balancer listener. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) + 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"` + + // The target listener. + // + // The target listener must be in this load balancer, and must not be the same as the + // listener in the URL. + 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. 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"` +} + +// 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 URL for this load balancer pool. + 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. 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"` +} + +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 +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerReference : LoadBalancerListenerPolicyTargetLoadBalancerListenerReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerReference 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 load balancer listener. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerReference) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerReference) + 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 + } + 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this load balancer pool. + 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref : LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolFailsafePolicyTargetPatch +type LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref struct { + // The URL for this load balancer pool. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref +func (loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref.Href) { + _patch["href"] = loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref.Href + } + + return +} + +// LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID : LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolFailsafePolicyTargetPatch +type LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID +func (loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID.ID) { + _patch["id"] = loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID.ID + } + + return +} + +// LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype : LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype struct +// This model "extends" LoadBalancerPoolHealthMonitorPrototype +type LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype 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 to use. + // + // 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 LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototypeTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototypeTypeHTTPSConst = "https" +) + +// NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype, err error) { + _model = &LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype{ + 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 +} + +func (*LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype) + 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 +} + +// LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype : LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype struct +// This model "extends" LoadBalancerPoolHealthMonitorPrototype +type LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype 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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototypeTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype, err error) { + _model = &LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype{ + 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 +} + +func (*LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorTypeHttphttps : LoadBalancerPoolHealthMonitorTypeHttphttps struct +// This model "extends" LoadBalancerPoolHealthMonitor +type LoadBalancerPoolHealthMonitorTypeHttphttps 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 used for health checks. + Type *string `json:"type" validate:"required"` + + // The health check URL path, in the format of an [origin-form request + // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorTypeHttphttps.Type property. +// The protocol type used for health checks. +const ( + LoadBalancerPoolHealthMonitorTypeHttphttpsTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorTypeHttphttpsTypeHTTPSConst = "https" +) + +func (*LoadBalancerPoolHealthMonitorTypeHttphttps) isaLoadBalancerPoolHealthMonitor() bool { + return true +} + +// UnmarshalLoadBalancerPoolHealthMonitorTypeHttphttps unmarshals an instance of LoadBalancerPoolHealthMonitorTypeHttphttps from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorTypeHttphttps(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorTypeHttphttps) + 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 +} + +// LoadBalancerPoolHealthMonitorTypeTCP : LoadBalancerPoolHealthMonitorTypeTCP struct +// This model "extends" LoadBalancerPoolHealthMonitor +type LoadBalancerPoolHealthMonitorTypeTCP 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 used for health checks. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorTypeTCP.Type property. +// The protocol type used for health checks. +const ( + LoadBalancerPoolHealthMonitorTypeTCPTypeTCPConst = "tcp" +) + +func (*LoadBalancerPoolHealthMonitorTypeTCP) isaLoadBalancerPoolHealthMonitor() bool { + return true +} + +// UnmarshalLoadBalancerPoolHealthMonitorTypeTCP unmarshals an instance of LoadBalancerPoolHealthMonitorTypeTCP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorTypeTCP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorTypeTCP) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The URL for this load balancer pool. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +// - 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 +} + +// 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 +} + +// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity : Identifies a load balancer by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity struct { + // The unique identifier for this load balancer. + ID *string `json:"id,omitempty"` + + // The CRN for this load balancer. + CRN *string `json:"crn,omitempty"` + + // The URL for this load balancer. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity +func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.ID) { + _patch["id"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.ID + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.CRN) { + _patch["crn"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.CRN + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.Href) { + _patch["href"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.Href + } + + 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 *Deleted `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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetLoadBalancerReference : LoadBalancerPoolMemberTargetLoadBalancerReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetLoadBalancerReference 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 LoadBalancerPoolMemberTargetLoadBalancerReference.ResourceType property. +// The resource type. +const ( + LoadBalancerPoolMemberTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*LoadBalancerPoolMemberTargetLoadBalancerReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetLoadBalancerReference unmarshals an instance of LoadBalancerPoolMemberTargetLoadBalancerReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetLoadBalancerReference) + 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 +} + +// 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 +} + +// LoadBalancerProfileFailsafePolicyActionsDependent : The failsafe policy action configuration for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileFailsafePolicyActions +type LoadBalancerProfileFailsafePolicyActionsDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileFailsafePolicyActionsDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileFailsafePolicyActionsDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileFailsafePolicyActionsDependent) isaLoadBalancerProfileFailsafePolicyActions() bool { + return true +} + +// UnmarshalLoadBalancerProfileFailsafePolicyActionsDependent unmarshals an instance of LoadBalancerProfileFailsafePolicyActionsDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileFailsafePolicyActionsDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileFailsafePolicyActionsDependent) + 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 +} + +// LoadBalancerProfileFailsafePolicyActionsEnum : The failsafe policy action configuration for a load balancer with this profile. +// This model "extends" LoadBalancerProfileFailsafePolicyActions +type LoadBalancerProfileFailsafePolicyActionsEnum struct { + // The default failsafe policy action for this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported failsafe policy actions. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Default property. +// The default failsafe policy action for this profile. +const ( + LoadBalancerProfileFailsafePolicyActionsEnumDefaultBypassConst = "bypass" + LoadBalancerProfileFailsafePolicyActionsEnumDefaultDropConst = "drop" + LoadBalancerProfileFailsafePolicyActionsEnumDefaultFailConst = "fail" + LoadBalancerProfileFailsafePolicyActionsEnumDefaultForwardConst = "forward" +) + +// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileFailsafePolicyActionsEnumTypeEnumConst = "enum" +) + +// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Values property. +// A load balancer failsafe policy action: +// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. +// - `drop`: Drops requests. +// - `fail`: Fails requests with an HTTP `503` status code. +// - `forward`: Forwards requests to the `target` pool. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerProfileFailsafePolicyActionsEnumValuesBypassConst = "bypass" + LoadBalancerProfileFailsafePolicyActionsEnumValuesDropConst = "drop" + LoadBalancerProfileFailsafePolicyActionsEnumValuesFailConst = "fail" + LoadBalancerProfileFailsafePolicyActionsEnumValuesForwardConst = "forward" +) + +func (*LoadBalancerProfileFailsafePolicyActionsEnum) isaLoadBalancerProfileFailsafePolicyActions() bool { + return true +} + +// UnmarshalLoadBalancerProfileFailsafePolicyActionsEnum unmarshals an instance of LoadBalancerProfileFailsafePolicyActionsEnum from the specified map of raw messages. +func UnmarshalLoadBalancerProfileFailsafePolicyActionsEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileFailsafePolicyActionsEnum) + 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 +} + +// 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 no traffic being allowed. + 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"` + + // The 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 : A rule for ICMP, TCP and UDP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for ICMP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 the TCP or UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of the TCP or UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of the TCP or UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of the TCP or 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 name of the network protocol. +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 : A rule for ICMP, TCP and UDP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for ICMP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for TCP or UDP traffic. +// 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 the TCP or UDP destination port range. + // + // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, + // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, + // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of the TCP or UDP source port range. + // + // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + // + // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` + // must also be unspecified, allowing traffic for all source ports. + 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 name of the network protocol. +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 : A rule for ICMP, TCP and UDP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for ICMP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for TCP or UDP traffic. +// 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 the TCP or UDP destination port range. + // + // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, + // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + // + // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, + // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of the TCP or UDP source port range. + // + // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` + // must also be unspecified, allowing traffic for all source ports. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP source port range. + // + // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` + // must also be unspecified, allowing traffic for all source ports. + 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 name of the network protocol. +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 : A rule for ICMP, TCP and UDP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 : A rule for ICMP traffic. +// 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 name of the network protocol. + 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 name of the network protocol. +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 the TCP or UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of the TCP or UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of the TCP or UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of the TCP or 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 name of the network protocol. +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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +} + +// 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 +// - 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, UnmarshalDeleted) + 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 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 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, 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 +} + +// 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 *Deleted `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, 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 +} + +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // 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 *Deleted `json:"deleted,omitempty"` + + // 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 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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 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 *Deleted `json:"deleted,omitempty"` + + // 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 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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 +} + +// 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 +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchVPNGatewayConnectionIdentity 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 (*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 +} + +// 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 +// - 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this VPN gateway connection. + 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, 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 +} + +// 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // The CRN for this security group. + 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 URL for this security group. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 ICMP, TCP and UDP traffic. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to allow. + Direction *string `json:"direction" validate:"required"` + + // 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 in that group matching this IP + // version. + IPVersion *string `json:"ip_version,omitempty"` + + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to allow. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The name of the network protocol. +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.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + 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 +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to allow. + Direction *string `json:"direction" validate:"required"` + + // 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 in that group matching this IP + // version. + IPVersion *string `json:"ip_version,omitempty"` + + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,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 name of the network protocol. + 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 allow. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The name of the network protocol. +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, "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.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, "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 +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to allow. + Direction *string `json:"direction" validate:"required"` + + // 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 in that group matching this IP + // version. + IPVersion *string `json:"ip_version,omitempty"` + + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The inclusive upper bound of the TCP or 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 the TCP or 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 of the network protocol. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to allow. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The name of the network protocol. +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.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + 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 +} + +// 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 +} + +// 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 { + // 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 +} + +// 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 +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The CRN for this security group. + CRN *string `json:"crn,omitempty"` + + // The URL for this security group. + 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 +} + +// 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 { + // 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 CRN for this security group. + CRN *string `json:"crn,omitempty"` + + // The URL for this security group. + 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 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 *Deleted `json:"deleted,omitempty"` + + // The URL for this security group. + 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, 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing ICMP, TCP and UDP traffic. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to allow. + 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 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 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 name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to allow. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The name of the network protocol. +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 allow. + 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 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 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 name of the network protocol. + 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 allow. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The name of the network protocol. +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 allow. + 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 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 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 the TCP or UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the TCP or UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The name of the network protocol. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to allow. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// 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 in that group matching this IP +// version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The name of the network protocol. +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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference 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 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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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 +} + +// 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 *Deleted `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, 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, "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 +} + +// 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 *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 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, 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 +} + +// 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 { + // 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: +// +// - 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 +// +// 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 protocol to use to access the share for this share mount target: + // - `nfs4`: NFSv4 will be used. + // + // The specified value must be listed in the share's `allowed_access_protocols`. + AccessProtocol *string `json:"access_protocol" validate:"required"` + + // The name for this share mount target. The name must not be used by another mount target for the file share. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` + + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.AccessProtocol property. +// The protocol to use to access the share for this share mount target: +// - `nfs4`: NFSv4 will be used. +// +// The specified value must be listed in the share's `allowed_access_protocols`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupAccessProtocolNfs4Const = "nfs4" +) + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `ipsec`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionIpsecConst = "ipsec" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionStunnelConst = "stunnel" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(accessProtocol string, transitEncryption string, virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ + AccessProtocol: core.StringPtr(accessProtocol), + TransitEncryption: core.StringPtr(transitEncryption), + 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, "access_protocol", &obj.AccessProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) + return + } + 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 protocol to use to access the share for this share mount target: + // - `nfs4`: NFSv4 will be used. + // + // The specified value must be listed in the share's `allowed_access_protocols`. + AccessProtocol *string `json:"access_protocol" validate:"required"` + + // The name for this share mount target. The name must not be used by another mount target for the file share. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.AccessProtocol property. +// The protocol to use to access the share for this share mount target: +// - `nfs4`: NFSv4 will be used. +// +// The specified value must be listed in the share's `allowed_access_protocols`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCAccessProtocolNfs4Const = "nfs4" +) + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `ipsec`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionIpsecConst = "ipsec" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionStunnelConst = "stunnel" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(accessProtocol string, transitEncryption string, vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ + AccessProtocol: core.StringPtr(accessProtocol), + TransitEncryption: core.StringPtr(transitEncryption), + 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, "access_protocol", &obj.AccessProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) + return + } + 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 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"` + + // 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"` +} + +// 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" + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeEnabledConst = "enabled" +) + +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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileAllowedAccessProtocolsSubset : ShareProfileAllowedAccessProtocolsSubset struct +// This model "extends" ShareProfileAllowedAccessProtocols +type ShareProfileAllowedAccessProtocolsSubset struct { + // The default allowed access protocol modes for shares with this profile. + Default []string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible allowed access protocols for shares with this profile: + // - `nfs4`: NFSv4 will be used. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Default property. +const ( + ShareProfileAllowedAccessProtocolsSubsetDefaultNfs4Const = "nfs4" +) + +// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Type property. +// The type for this profile field. +const ( + ShareProfileAllowedAccessProtocolsSubsetTypeSubsetConst = "subset" +) + +// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Values property. +const ( + ShareProfileAllowedAccessProtocolsSubsetValuesNfs4Const = "nfs4" +) + +func (*ShareProfileAllowedAccessProtocolsSubset) isaShareProfileAllowedAccessProtocols() bool { + return true +} + +// UnmarshalShareProfileAllowedAccessProtocolsSubset unmarshals an instance of ShareProfileAllowedAccessProtocolsSubset from the specified map of raw messages. +func UnmarshalShareProfileAllowedAccessProtocolsSubset(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAllowedAccessProtocolsSubset) + 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 +} + +// ShareProfileAllowedTransitEncryptionModesSubset : ShareProfileAllowedTransitEncryptionModesSubset struct +// This model "extends" ShareProfileAllowedTransitEncryptionModes +type ShareProfileAllowedTransitEncryptionModesSubset struct { + // The default allowed transit encryption modes for shares with this profile. + Default []string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The allowed [transit encryption modes](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for a share with this profile: + // - `none`: Not encrypted in transit. + // - `ipsec`: Encrypted in transit using an instance identity certificate. + // - `stunnel`: Encrypted in transit using a connection via an stunnel connection. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Default property. +const ( + ShareProfileAllowedTransitEncryptionModesSubsetDefaultIpsecConst = "ipsec" + ShareProfileAllowedTransitEncryptionModesSubsetDefaultNoneConst = "none" + ShareProfileAllowedTransitEncryptionModesSubsetDefaultStunnelConst = "stunnel" +) + +// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Type property. +// The type for this profile field. +const ( + ShareProfileAllowedTransitEncryptionModesSubsetTypeSubsetConst = "subset" +) + +// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Values property. +const ( + ShareProfileAllowedTransitEncryptionModesSubsetValuesIpsecConst = "ipsec" + ShareProfileAllowedTransitEncryptionModesSubsetValuesNoneConst = "none" + ShareProfileAllowedTransitEncryptionModesSubsetValuesStunnelConst = "stunnel" +) + +func (*ShareProfileAllowedTransitEncryptionModesSubset) isaShareProfileAllowedTransitEncryptionModes() bool { + return true +} + +// UnmarshalShareProfileAllowedTransitEncryptionModesSubset unmarshals an instance of ShareProfileAllowedTransitEncryptionModesSubset from the specified map of raw messages. +func UnmarshalShareProfileAllowedTransitEncryptionModesSubset(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAllowedTransitEncryptionModesSubset) + 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 +} + +// ShareProfileAvailabilityModesEnum : The permitted data availability modes for a share with this profile. +// This model "extends" ShareProfileAvailabilityModes +type ShareProfileAvailabilityModesEnum struct { + // The default data availability mode for this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: + // - `zonal`: The data availability of this share is limited only to a single zone of a + // given region as provided by the `zone` of the share. + // - `regional`: The data availability of this share covers all zones in the region where + // the share is created. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the ShareProfileAvailabilityModesEnum.Default property. +// The default data availability mode for this profile. +const ( + ShareProfileAvailabilityModesEnumDefaultRegionalConst = "regional" + ShareProfileAvailabilityModesEnumDefaultZonalConst = "zonal" +) + +// Constants associated with the ShareProfileAvailabilityModesEnum.Type property. +// The type for this profile field. +const ( + ShareProfileAvailabilityModesEnumTypeEnumConst = "enum" +) + +// Constants associated with the ShareProfileAvailabilityModesEnum.Values property. +const ( + ShareProfileAvailabilityModesEnumValuesRegionalConst = "regional" + ShareProfileAvailabilityModesEnumValuesZonalConst = "zonal" +) + +func (*ShareProfileAvailabilityModesEnum) isaShareProfileAvailabilityModes() bool { + return true +} + +// UnmarshalShareProfileAvailabilityModesEnum unmarshals an instance of ShareProfileAvailabilityModesEnum from the specified map of raw messages. +func UnmarshalShareProfileAvailabilityModesEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAvailabilityModesEnum) + 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 +} + +// ShareProfileAvailabilityModesFixed : The data availability mode for a share with this profile is fixed. +// This model "extends" ShareProfileAvailabilityModes +type ShareProfileAvailabilityModesFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileAvailabilityModesFixed.Type property. +// The type for this profile field. +const ( + ShareProfileAvailabilityModesFixedTypeFixedConst = "fixed" +) + +// Constants associated with the ShareProfileAvailabilityModesFixed.Value property. +// The value for this profile field. +const ( + ShareProfileAvailabilityModesFixedValueRegionalConst = "regional" + ShareProfileAvailabilityModesFixedValueZonalConst = "zonal" +) + +func (*ShareProfileAvailabilityModesFixed) isaShareProfileAvailabilityModes() bool { + return true +} + +// UnmarshalShareProfileAvailabilityModesFixed unmarshals an instance of ShareProfileAvailabilityModesFixed from the specified map of raw messages. +func UnmarshalShareProfileAvailabilityModesFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileAvailabilityModesFixed) + 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 +} + +// ShareProfileBandwidthDependent : The permitted bandwidth for a share with this profile depends on its configuration. +// This model "extends" ShareProfileBandwidth +type ShareProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*ShareProfileBandwidthDependent) isaShareProfileBandwidth() bool { + return true +} + +// UnmarshalShareProfileBandwidthDependent unmarshals an instance of ShareProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalShareProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidthDependent) + 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 +} + +// ShareProfileBandwidthDependentRange : The permitted bandwidth range of a share with this profile depends on its configuration. +// This model "extends" ShareProfileBandwidth +type ShareProfileBandwidthDependentRange 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 ShareProfileBandwidthDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*ShareProfileBandwidthDependentRange) isaShareProfileBandwidth() bool { + return true +} + +// UnmarshalShareProfileBandwidthDependentRange unmarshals an instance of ShareProfileBandwidthDependentRange from the specified map of raw messages. +func UnmarshalShareProfileBandwidthDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidthDependentRange) + 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 +} + +// ShareProfileBandwidthEnum : The permitted bandwidth values of a share with this profile. +// This model "extends" ShareProfileBandwidth +type ShareProfileBandwidthEnum 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 ShareProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*ShareProfileBandwidthEnum) isaShareProfileBandwidth() bool { + return true +} + +// UnmarshalShareProfileBandwidthEnum unmarshals an instance of ShareProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalShareProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidthEnum) + 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 +} + +// ShareProfileBandwidthFixed : The permitted bandwidth of a share with this profile is fixed. +// This model "extends" ShareProfileBandwidth +type ShareProfileBandwidthFixed 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 ShareProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileBandwidthFixed) isaShareProfileBandwidth() bool { + return true +} + +// UnmarshalShareProfileBandwidthFixed unmarshals an instance of ShareProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalShareProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidthFixed) + 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 +} + +// ShareProfileBandwidthRange : The permitted bandwidth range (in megabits per second) of a share with this profile. +// This model "extends" ShareProfileBandwidth +type ShareProfileBandwidthRange 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"` + + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the ShareProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + ShareProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*ShareProfileBandwidthRange) isaShareProfileBandwidth() bool { + return true +} + +// UnmarshalShareProfileBandwidthRange unmarshals an instance of ShareProfileBandwidthRange from the specified map of raw messages. +func UnmarshalShareProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileBandwidthRange) + 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 + } + 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 +} + +// 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 ( + 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 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, "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 +} + +// ShareProfileIopsDependent : The permitted IOPS for a share with this profile depends on its configuration. +// This model "extends" ShareProfileIops +type ShareProfileIopsDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileIopsDependent.Type property. +// The type for this profile field. +const ( + ShareProfileIopsDependentTypeDependentConst = "dependent" +) + +func (*ShareProfileIopsDependent) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsDependent unmarshals an instance of ShareProfileIopsDependent from the specified map of raw messages. +func UnmarshalShareProfileIopsDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsDependent) + 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 ( + 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 +} + +// 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 { + // 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 +} + +// 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 +// `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, +// `initial_owner`, `iops`, `profile`, `size`, and `zone` will be inherited from +// `origin_share`. +// +// Accessor file shares can only be created for shares with an `availability_mode` of +// `zonal`. +// This model "extends" SharePrototype +type SharePrototypeShareByOriginShare struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + 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 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" validate:"required"` +} + +// Constants associated with the SharePrototypeShareByOriginShare.AllowedTransitEncryptionModes property. +const ( + SharePrototypeShareByOriginShareAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeShareByOriginShareAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareByOriginShareAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// 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, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + 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: + // + // - `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 access protocols to allow for this share. If unspecified: + // - If share mount targets are specified, only the access protocols specified by those + // share mount target will be allowed. + // - Otherwise, the default access protocols from the profile will be used. + AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` + + // The maximum bandwidth (in megabits per second) for the file share. + // + // If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this property is system-managed and must not + // be specified. Otherwise, the specified value must be within the `bandwidth` range of the share's profile. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `size` and `iops`](https://cloud.ibm.com/docs/vpc?topic=_TBD_). + Bandwidth *int64 `json:"bandwidth,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 maximum input/output operations per second (IOPS) for the file share. + // + // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be + // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the + // share's specified size. + 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 of the file share (in gigabytes), excluding share snapshots. + // + // The specified value must be within the permitted `capacity` range of the share's profile and supported by the + // share's specified IOPS. + Size *int64 `json:"size" validate:"required"` + + // 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. + // + // This property must not be specified if the `availability_mode` of the profile for the + // share is `regional`. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SharePrototypeShareBySize.AllowedTransitEncryptionModes property. +const ( + SharePrototypeShareBySizeAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeShareBySizeAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySizeAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// 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" +) + +// Constants associated with the SharePrototypeShareBySize.AllowedAccessProtocols property. +const ( + SharePrototypeShareBySizeAllowedAccessProtocolsNfs4Const = "nfs4" +) + +// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { + _model = &SharePrototypeShareBySize{ + Profile: profile, + 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, "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.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, "allowed_access_protocols", &obj.AllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "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, "", "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.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 +} + +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for +// `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, +// `initial_owner`, and `size` will be inherited from the `source_share`. +// +// Replica file shares can only be created for shares with an `availability_mode` of +// `zonal`. +// This model "extends" SharePrototype +type SharePrototypeShareBySourceShare struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + 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. + // + // 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 maximum input/output operations per second (IOPS) for the file share. + // + // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be + // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the + // share's specified size. + 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 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 + // 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"` + + // 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. + // + // This property must not be specified if the `availability_mode` of the profile for the + // share is `regional`. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SharePrototypeShareBySourceShare.AllowedTransitEncryptionModes property. +const ( + SharePrototypeShareBySourceShareAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeShareBySourceShareAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySourceShareAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { + _model = &SharePrototypeShareBySourceShare{ + Profile: profile, + 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, "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.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.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`, +// `bandwidth`, and `zone` 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, then only transit encryption modes + // specified by those share mount target will be allowed. + // - Otherwise, the default allowed transit encryption modes from the profile will be + // used. + 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 protocols to allow for this share. If unspecified: + // - If share mount targets are specified, only the access protocols specified by those + // share mount target will be allowed. + // - Otherwise, the default access protocols from the profile will be used. + AllowedAccessProtocols []string `json:"allowed_access_protocols,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. + // + // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be + // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the + // share's specified size. + 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. +const ( + SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesIpsecConst = "ipsec" + SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesStunnelConst = "stunnel" +) + +// Constants associated with the SharePrototypeShareBySourceSnapshot.AllowedAccessProtocols property. +const ( + SharePrototypeShareBySourceSnapshotAllowedAccessProtocolsNfs4Const = "nfs4" +) + +// 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.UnmarshalPrimitive(m, "allowed_access_protocols", &obj.AllowedAccessProtocols) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "", "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.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 +} + +// 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, "", "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)) + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 TrustedProfileIdentityByCRN struct { + // The CRN for this trusted profile. + CRN *string `json:"crn" validate:"required"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*TrustedProfileIdentityByCRN) isaTrustedProfileIdentity() bool { + return true +} + +// 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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityByID : TrustedProfileIdentityByID struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityByID struct { + // The unique identifier for this trusted profile. + ID *string `json:"id" validate:"required"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*TrustedProfileIdentityByID) isaTrustedProfileIdentity() bool { + return true +} + +// 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()) + 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` + // + // 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. + 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` + // + // 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. + // + // 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. + // + // 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. + 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` + // + // 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. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `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 + // - 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. Applies 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 *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 { + // The URL for this IKE policy. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The URL for this IKE policy. + 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 URL for this IPsec policy. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The URL for this IPsec policy. + 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 +} + +// 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: +// - 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 +} + +// 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. + // + // 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. + 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 URL for this VPN gateway connection. + 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. + // + // 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. + 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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. +// +// 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" +) + +// 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"` + + // 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"` + + // 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.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()) + 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. + // + // 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. + 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 URL for this VPN gateway connection. + 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. + // + // 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. + 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"` + + // 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"` + + // 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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. +// +// 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" +) + +// 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 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"` + + // 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. + 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 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"` + + // 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. + 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. + // + // 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). + 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. +// +// 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" +) + +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. + // + // 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. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// 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" +) + +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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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: +// - 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 *Deleted `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, 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 +} + +// 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 bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // 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. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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 +} + +// 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 +} + +// VolumeProfileBandwidthDependent : The maximum bandwidth (in Mbps) of a volume with this profile depends on its configuration. +// This model "extends" VolumeProfileBandwidth +type VolumeProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*VolumeProfileBandwidthDependent) isaVolumeProfileBandwidth() bool { + return true +} + +// UnmarshalVolumeProfileBandwidthDependent unmarshals an instance of VolumeProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidthDependent) + 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 +} + +// VolumeProfileBandwidthDependentRange : The maximum bandwidth (in Mbps) of a volume with this profile varies depending on its configuration. +// This model "extends" VolumeProfileBandwidth +type VolumeProfileBandwidthDependentRange 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 VolumeProfileBandwidthDependentRange.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*VolumeProfileBandwidthDependentRange) isaVolumeProfileBandwidth() bool { + return true +} + +// UnmarshalVolumeProfileBandwidthDependentRange unmarshals an instance of VolumeProfileBandwidthDependentRange from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidthDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidthDependentRange) + 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 +} + +// VolumeProfileBandwidthEnum : The available maximum bandwidth values (in Mbps) of a volume with this profile. +// This model "extends" VolumeProfileBandwidth +type VolumeProfileBandwidthEnum 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 VolumeProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*VolumeProfileBandwidthEnum) isaVolumeProfileBandwidth() bool { + return true +} + +// UnmarshalVolumeProfileBandwidthEnum unmarshals an instance of VolumeProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidthEnum) + 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 +} + +// VolumeProfileBandwidthFixed : The maximum bandwidth (in Mbps) of a volume with this profile is fixed. +// This model "extends" VolumeProfileBandwidth +type VolumeProfileBandwidthFixed 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 VolumeProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*VolumeProfileBandwidthFixed) isaVolumeProfileBandwidth() bool { + return true +} + +// UnmarshalVolumeProfileBandwidthFixed unmarshals an instance of VolumeProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidthFixed) + 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 +} + +// VolumeProfileBandwidthRange : The maximum bandwidth range (in Mbps) of a volume with this profile. +// This model "extends" VolumeProfileBandwidth +type VolumeProfileBandwidthRange 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 VolumeProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + VolumeProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*VolumeProfileBandwidthRange) isaVolumeProfileBandwidth() bool { + return true +} + +// UnmarshalVolumeProfileBandwidthRange unmarshals an instance of VolumeProfileBandwidthRange from the specified map of raw messages. +func UnmarshalVolumeProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBandwidthRange) + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // The maximum bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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. + // + // 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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.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 bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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"` + + // 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 to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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.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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +// - 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. + 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. + 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 + // + // 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. + 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 +// +// 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" + 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. + 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. + 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 + // + // 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. + 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 +// +// 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" + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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. + // 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"` + + // 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 this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +// 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, "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()) + 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()) + 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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 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. + 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"` + + // 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"` + + // 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"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for this 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 + // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). + // + // 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"` +} + +// 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" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" +) + +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.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()) + 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, "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, "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 +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct { + // The URL for this load balancer listener. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref +func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref.Href) { + _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref.Href + } + + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID +func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID.ID) { + _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID.ID + } + + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The URL for this load balancer pool. + 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 +} + +// 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 { + // 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 +} + +// 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 +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct { + // The URL for this load balancer listener. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) + 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 URL for this load balancer pool. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 +} + +// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity +type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN struct { + // The CRN for this load balancer. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) + 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 LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN +func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN.CRN) { + _patch["crn"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN.CRN + } + + return +} + +// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity +type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref struct { + // The URL for this load balancer. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref +func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref.Href) { + _patch["href"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref.Href + } + + return +} + +// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity +type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) + 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 +} + +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID +func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID.ID) { + _patch["id"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID.ID + } + + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The URL for this VPN gateway connection. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototype() bool { + return true +} + +// 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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + // - `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"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototype() bool { + return true +} + +// 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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The URL for this VPN gateway connection. + Href *string `json:"href" validate:"required"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototype() bool { + return true +} + +// 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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// 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") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototype() bool { + return true +} + +// 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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The CRN for this security group. + 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 +} + +// 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 { + // The URL for this security group. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // The CRN for this security group. + 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 URL for this security group. + 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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 { + // 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 +} + +// 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. + // + // 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. + 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 URL for this VPN gateway connection. + 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. + // + // 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. + 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"` + + // 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"` + + // 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. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +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. +// +// 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" +) + +// 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.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()) + 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 bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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. + // + // 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { + // The maximum bandwidth (in megabits per second) for the volume. + // + // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be + // specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` + // and + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. + // + // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. + // + // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ + // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). + 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) 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 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"` + + // 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 to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. + // + // To create a volume from a `source_snapshot`, the volume profile and the + // source snapshot must have the same `storage_generation` value. + 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, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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 +} + +// 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 []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 { + 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 []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 *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 []Route, 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 +} + +// 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 + 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 +} + +// 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 + 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// IkePolicyConnectionsPager can be used to simplify the use of the "ListIkePolicyConnections" method. +type IkePolicyConnectionsPager struct { + hasNext bool + options *ListIkePolicyConnectionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// 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 ListIkePolicyConnectionsOptions = *options + pager = &IkePolicyConnectionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IkePolicyConnectionsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +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.ListIkePolicyConnectionsWithContext(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.Connections + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { + for pager.HasNext() { + var nextPage []VPNGatewayConnectionIntf + 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 *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 *IkePolicyConnectionsPager) 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 { + 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 +} + +// IpsecPolicyConnectionsPager can be used to simplify the use of the "ListIpsecPolicyConnections" method. +type IpsecPolicyConnectionsPager struct { + hasNext bool + options *ListIpsecPolicyConnectionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// 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 ListIpsecPolicyConnectionsOptions = *options + pager = &IpsecPolicyConnectionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IpsecPolicyConnectionsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +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.ListIpsecPolicyConnectionsWithContext(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.Connections + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { + for pager.HasNext() { + var nextPage []VPNGatewayConnectionIntf + 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 *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 *IpsecPolicyConnectionsPager) 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 { + hasNext bool + options *ListVPNGatewayConnectionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// 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 ListVPNGatewayConnectionsOptions = *options + pager = &VPNGatewayConnectionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNGatewayConnectionsPager) 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) { + 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) + 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.Connections + + 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) { + for pager.HasNext() { + var nextPage []VPNGatewayConnectionIntf + 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 *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 *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 +} + +// 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 +} + +// 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 +} diff --git a/go.mod b/go.mod index 57dc9839bf..37d94cc1a0 100644 --- a/go.mod +++ b/go.mod @@ -235,6 +235,8 @@ replace github.com/hashicorp/consul/api v1.1.0 => github.com/hashicorp/consul/ap replace github.com/hashicorp/vault => github.com/hashicorp/vault v1.18.2 +replace github.com/IBM/vpc-go-sdk => ./common/github.com/IBM/vpc-go-sdk + replace github.com/hashicorp/vault/api/auth/approle => github.com/hashicorp/vault/api/auth/approle v0.8.0 exclude ( 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 8b2ec5dea9..df04eed211 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 @@ -41,6 +41,11 @@ func DataSourceIBMIsShareTarget() *schema.Resource { ExactlyOneOf: []string{"mount_target", "mount_target_name"}, Description: "The share target name.", }, + "access_protocol": { + Type: schema.TypeString, + Computed: true, + Description: "The protocol to use to access the share for this share mount target.", + }, "transit_encryption": { Type: schema.TypeString, Computed: true, @@ -353,6 +358,11 @@ func dataSourceIBMIsShareTargetRead(context context.Context, d *schema.ResourceD if err = d.Set("resource_type", shareTarget.ResourceType); err != nil { return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) } + if shareTarget.AccessProtocol != nil { + if err = d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil { + return diag.FromErr(fmt.Errorf("Error setting access_protocol: %s", err)) + } + } if shareTarget.TransitEncryption != nil { if err = d.Set("transit_encryption", *shareTarget.TransitEncryption); err != nil { return diag.FromErr(fmt.Errorf("Error setting transit_encryption: %s", err)) diff --git a/ibm/service/vpc/data_source_ibm_is_share_mount_targets.go b/ibm/service/vpc/data_source_ibm_is_share_mount_targets.go index 6a8645360f..e90806d124 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_mount_targets.go +++ b/ibm/service/vpc/data_source_ibm_is_share_mount_targets.go @@ -43,6 +43,11 @@ func DataSourceIBMIsShareTargets() *schema.Resource { Computed: true, Description: "The access control mode for the share", }, + "access_protocol": { + Type: schema.TypeString, + Computed: true, + Description: "The protocol to use to access the share for this share mount target.", + }, "name": { Type: schema.TypeString, Computed: true, @@ -342,6 +347,9 @@ func dataSourceShareMountTargetCollectionTargetsToMap(targetsItem vpcv1.ShareMou if targetsItem.AccessControlMode != nil { targetsMap["access_control_mode"] = *targetsItem.AccessControlMode } + if targetsItem.AccessProtocol != nil { + targetsMap["access_protocol"] = *targetsItem.AccessProtocol + } if targetsItem.CreatedAt != nil { targetsMap["created_at"] = targetsItem.CreatedAt.String() } diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 18269e71e3..97f03fa417 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -60,6 +60,20 @@ func ResourceIbmIsShare() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Allowed transit encryption modes", }, + "allowed_access_protocols": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + ConflictsWith: []string{"replica_share", "origin_share"}, + Description: "The access protocols to allow for this share", + }, + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "The initial group identifier for the file share.", + }, "encryption_key": { Type: schema.TypeString, Optional: true, @@ -983,7 +997,7 @@ func ResourceIbmIsShare() *schema.Resource { } func ResourceIbmIsShareValidator() *validate.ResourceValidator { - allowed_transit_encryption_modes := "none, user_managed" + allowed_transit_encryption_modes := "none, user_managed, ipsec, stunnel" validateSchema := make([]validate.ValidateSchema, 1) validateSchema = append(validateSchema, validate.ValidateSchema{ @@ -1056,13 +1070,32 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m accessControlMode := accessControlModeIntf.(string) sharePrototype.AccessControlMode = &accessControlMode } + if allowedAccessProtocols, ok := d.GetOk("allowed_access_protocols"); ok { + allowedAccessProtocolsList := []string{} + for _, allowedAccessProtocolsIntf := range allowedAccessProtocols.([]interface{}) { + allowedAccessProtocolsList = append(allowedAccessProtocolsList, allowedAccessProtocolsIntf.(string)) + } + sharePrototype.AllowedAccessProtocols = allowedAccessProtocolsList + } else { + allowedAccessProtocols := []string{"nfs4"} + sharePrototype.AllowedAccessProtocols = allowedAccessProtocols + } + if bandwidthIntf, bandwidthOk := d.GetOk("bandwidth"); bandwidthOk { + bandwidth := int64(bandwidthIntf.(int)) + sharePrototype.Bandwidth = &bandwidth + } if allowedTransitEncryptionModesIntf, ok := d.GetOk("allowed_transit_encryption_modes"); ok { allowedTransitEncryptionModes := []string{} - for _, allowedTransitEncryptionModesItem := range allowedTransitEncryptionModesIntf.([]interface{}) { - allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem.(string)) + for _, allowedTransitEncryptionModesItemIntf := range allowedTransitEncryptionModesIntf.([]interface{}) { + allowedTransitEncryptionModesItem := allowedTransitEncryptionModesItemIntf.(string) + if allowedTransitEncryptionModesItem == "user_managed" { + allowedTransitEncryptionModesItem = "ipsec" + } + allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) } sharePrototype.AllowedTransitEncryptionModes = allowedTransitEncryptionModes } + if encryptionKeyIntf, ok := d.GetOk("encryption_key"); ok { encryptionKey := encryptionKeyIntf.(string) encryptionKeyIdentity := &vpcv1.EncryptionKeyIdentity{ @@ -1351,6 +1384,14 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met return diag.FromErr(fmt.Errorf("Error setting access_control_mode: %s", err)) } } + if share.AllowedAccessProtocols != nil && len(share.AllowedAccessProtocols) > 0 { + if err = d.Set("allowed_access_protocols", *&share.AllowedAccessProtocols); err != nil { + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag() + } + } + if err = d.Set("bandwidth", flex.IntValue(share.Bandwidth)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting bandwidth: %s", err)) + } if !core.IsNil(share.AllowedTransitEncryptionModes) { if err = d.Set("allowed_transit_encryption_modes", share.AllowedTransitEncryptionModes); err != nil { err = fmt.Errorf("Error setting allowed_transit_encryption_modes: %s", err) @@ -1916,6 +1957,7 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso hasChange := false hasSizeChanged := false + hasBandwidthChanged := false sharePatchModel := &vpcv1.SharePatch{} shareNameSchema := "" shareIopsSchema := "" @@ -1958,8 +2000,12 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso sharePatchModel.Size = &size hasChange = true } - } - if shareType == "share" { + if d.HasChange("bandwidth") { + bandwidth := int64(d.Get("bandwidth").(int)) + hasBandwidthChanged = true + sharePatchModel.Bandwidth = &bandwidth + hasChange = true + } if d.HasChange("access_control_mode") { accessControlMode := d.Get("access_control_mode").(string) if accessControlMode != "" { @@ -2033,7 +2079,7 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso return err } updateShareOptions.SetSharePatch(sharePatch) - if hasSizeChanged { + if hasSizeChanged || hasBandwidthChanged { _, err = isWaitForShareAvailable(context, vpcClient, d.Id(), d, d.Timeout(schema.TimeoutCreate)) if err != nil { return err diff --git a/ibm/service/vpc/resource_ibm_is_share_mount_target.go b/ibm/service/vpc/resource_ibm_is_share_mount_target.go index ee7397f0e8..8b795049fd 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -35,6 +35,13 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { ForceNew: true, Description: "The file share identifier.", }, + "access_protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Default: "nfs4", + Description: "The protocol to use to access the share for this share mount target.", + }, "name": { Type: schema.TypeString, Required: true, @@ -47,6 +54,15 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { ForceNew: true, Computed: true, Description: "The transit encryption mode.", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "user_managed" && new == "ipsec" { + return true + } + if old == "ipsec" && new == "user_managed" { + return true + } + return false + }, }, "access_control_mode": { Type: schema.TypeString, @@ -340,9 +356,23 @@ func resourceIBMIsShareMountTargetCreate(context context.Context, d *schema.Reso name := nameIntf.(string) shareMountTargetPrototype.Name = &name } + if accessProtocolIntf, ok := d.GetOk("access_protocol"); ok { + accessProtocol := accessProtocolIntf.(string) + shareMountTargetPrototype.AccessProtocol = &accessProtocol + } if transitEncryptionIntf, ok := d.GetOk("transit_encryption"); ok { transitEncryption := transitEncryptionIntf.(string) + if transitEncryption == "user_managed" { + transitEncryption = "ipsec" + } shareMountTargetPrototype.TransitEncryption = &transitEncryption + } else { + if _, ok := d.GetOk("vpc"); ok { + shareMountTargetPrototype.TransitEncryption = &[]string{"none"}[0] + } else { + shareMountTargetPrototype.TransitEncryption = &[]string{"ipsec"}[0] + } + } createShareMountTargetOptions.ShareMountTargetPrototype = shareMountTargetPrototype shareTarget, response, err := vpcClient.CreateShareMountTargetWithContext(context, createShareMountTargetOptions) @@ -416,7 +446,11 @@ func resourceIBMIsShareMountTargetRead(context context.Context, d *schema.Resour return diag.FromErr(fmt.Errorf("Error setting transit_encryption: %s", err)) } } - + if shareTarget.AccessProtocol != nil { + if err = d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil { + return diag.FromErr(fmt.Errorf("Error setting access_protocol: %s", err)) + } + } if err = d.Set("created_at", shareTarget.CreatedAt.String()); err != nil { return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) } diff --git a/website/docs/d/is_share_mount_target.html.markdown b/website/docs/d/is_share_mount_target.html.markdown index 00cb4fab2f..d83f1c0e42 100644 --- a/website/docs/d/is_share_mount_target.html.markdown +++ b/website/docs/d/is_share_mount_target.html.markdown @@ -25,9 +25,11 @@ resource "ibm_is_share" "example" { } resource "ibm_is_share_mount_target" "example" { + access_protocol = "nfs4" share = ibm_is_share.is_share.id vpc = ibm_is_vpc.example.id name = "example-share-target" + transit_encryption = "none" } data "ibm_is_share_mount_target" "example" { @@ -47,6 +49,7 @@ The following arguments are supported: The following attributes are exported: +- `access_protocol` - The protocol to use to access the share for this share mount target. - `created_at` - The date and time that the share target was created. - `href` - The URL for this share target. - `lifecycle_state` - The lifecycle state of the mount target. diff --git a/website/docs/d/is_share_mount_targets.html.markdown b/website/docs/d/is_share_mount_targets.html.markdown index 2cb13d4b10..e73999d96e 100644 --- a/website/docs/d/is_share_mount_targets.html.markdown +++ b/website/docs/d/is_share_mount_targets.html.markdown @@ -40,6 +40,7 @@ The following attributes are exported: - `id` - The unique identifier of the ShareTargetCollection. - `mount_targets` - Collection of share targets. Nested `targets` blocks have the following structure: + - `access_protocol` - The protocol to use to access the share for this share mount target - `created_at` - The date and time that the share target was created. - `href` - The URL for this share target. - `id` - The unique identifier for this share target. diff --git a/website/docs/r/is_share.html.markdown b/website/docs/r/is_share.html.markdown index a0a7731c83..3a2270aa4c 100644 --- a/website/docs/r/is_share.html.markdown +++ b/website/docs/r/is_share.html.markdown @@ -126,6 +126,7 @@ resource "ibm_is_share" "example-6" { The following arguments are supported: +- `allowed_access_protocols` - (Optional, List) List of allowed access protocols for the share. Supported values are **nfs4** - `access_control_mode` - (Optional, Boolean) The access control mode for the share. Supported values are **security_group** and **vpc**. Default value is **security_group** - `allowed_transit_encryption_modes` - (Optional, List of string) The transit encryption modes allowed for this share. - `access_tags` - (Optional, List of Strings) The list of access management tags to attach to the share. **Note** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag). diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index ef05a78bf1..9f021a60d3 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -27,9 +27,11 @@ resource "ibm_is_share" "example" { } resource "ibm_is_share_mount_target" "example" { + access_protocol = "nfs4" share = ibm_is_share.example.id vpc = ibm_is_vpc.example.id name = "my-share-target" + transit_encryption = "none" }` ``` ``` @@ -54,6 +56,7 @@ resource "ibm_is_subnet" "example1" { } resource "ibm_is_share_mount_target" "example1" { + access_protocol = "nfs4" share = ibm_is_share.example1.id virtual_network_interface { primary_ip { @@ -63,16 +66,19 @@ resource "ibm_is_share_mount_target" "example1" { name = "my-example-vni" } name = "my-example-mount-target" + transit_encryption = "ipsec" } //Create a mount target with subnet id resource "ibm_is_share_mount_target" "example2" { + access_protocol = "nfs4" share = ibm_is_share.example.id virtual_network_interface { subnet = ibm_is_subnet.example.id name = "my-example-vni" } name = "my-example-mount-target" + transit_encryption = "ipsec" } //Create mount target with reserved ip id @@ -81,6 +87,7 @@ resource "ibm_is_subnet_reserved_ip" "example" { name = "my-example-resip" } resource "ibm_is_share_mount_target" "example" { + access_protocol = "nfs4" share = ibm_is_share.example.id virtual_network_interface { primary_ip { @@ -89,6 +96,7 @@ resource "ibm_is_share_mount_target" "example" { name = "my-example-vni" } name = "my-example-mount-target" + transit_encryption = "ipsec" } //Create mount target with VNI ID @@ -103,11 +111,13 @@ resource "ibm_is_virtual_network_interface" "example" { subnet = ibm_is_subnet.example.id } resource "ibm_is_share_mount_target" "mtarget1" { + access_protocol = "nfs4" share = ibm_is_share.share.id virtual_network_interface { id = ibm_is_virtual_network_interface.example.id } name = "my-example-mount-target" + transit_encryption = "ipsec" } ``` ## Argument Reference @@ -115,6 +125,7 @@ resource "ibm_is_share_mount_target" "mtarget1" { The following arguments are supported: - `share` - (Required, String) The file share identifier. +- `access_protocol` - (Required, String) The protocol to use to access the share for this share mount target. The specified value must be listed in the share's allowed_access_protocols. Available values are `nfs4` - `virtual_network_interface` (Optional, List) The virtual network interface for this share mount target. Required if the share's `access_control_mode` is `security_group`. - `name` - (Required, String) Name for this virtual network interface. The name must not be used by another virtual network interface in the VPC. Nested scheme for `virtual_network_interface`: @@ -150,10 +161,7 @@ The following arguments are supported: ~> **Note** `virtual_network_interface` and `vpc` are mutually exclusive and one of them must be provided. - `name` - (Required, String) The user-defined name for this share target. Names must be unique within the share the share target resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. -- `transit_encryption` - (Optional, String) The transit encryption mode for this share target. Supported values are **none**, **user_managed**. Default is **none** - -~> **Note** - `transit_encryption` can only be provided to create mount target for a share with `access_control_mode` `security_group`. It is not supported with shares that has `access_control_mode` `vpc` +- `transit_encryption` - (Required, String) The transit encryption mode for this share target. Supported values are **none**, **ipsec** and **stunnel** ## Attribute Reference From 48088f367176daa54611c9b1583d7bd2d8f21109 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 14 May 2025 10:16:21 +0530 Subject: [PATCH 02/13] updates to docs and test --- ibm/service/vpc/data_source_ibm_is_share.go | 21 ++++++ ibm/service/vpc/data_source_ibm_is_shares.go | 17 +++++ ...resource_ibm_is_share_mount_target_test.go | 65 +++++++++++++++++- .../vpc/resource_ibm_is_share_snapshot.go | 2 +- ibm/service/vpc/resource_ibm_is_share_test.go | 66 +++++++++++++++++++ website/docs/d/is_share.html.markdown | 2 + website/docs/d/is_shares.html.markdown | 2 + 7 files changed, 173 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_share.go b/ibm/service/vpc/data_source_ibm_is_share.go index cd15ea7a22..87a54807a9 100644 --- a/ibm/service/vpc/data_source_ibm_is_share.go +++ b/ibm/service/vpc/data_source_ibm_is_share.go @@ -41,6 +41,17 @@ func DataSourceIbmIsShare() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Allowed transit encryption modes", }, + "allowed_access_protocols": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Allowed access protocols for this share", + }, + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + Description: "The bandwidth for this share.", + }, "created_at": { Type: schema.TypeString, Computed: true, @@ -692,6 +703,16 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_transit_encryption_modes").GetDiag() } } + if !core.IsNil(share.AllowedAccessProtocols) { + if err = d.Set("allowed_access_protocols", share.AllowedAccessProtocols); err != nil { + err = fmt.Errorf("Error setting allowed_access_protocols: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag() + } + } + if err = d.Set("bandwidth", share.Bandwidth); err != nil { + err = fmt.Errorf("Error setting bandwidth: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-bandwidth").GetDiag() + } if err = d.Set("accessor_binding_role", share.AccessorBindingRole); err != nil { err = fmt.Errorf("Error setting accessor_binding_role: %s", err) return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-accessor_binding_role").GetDiag() diff --git a/ibm/service/vpc/data_source_ibm_is_shares.go b/ibm/service/vpc/data_source_ibm_is_shares.go index 58ac287351..4df8139f13 100644 --- a/ibm/service/vpc/data_source_ibm_is_shares.go +++ b/ibm/service/vpc/data_source_ibm_is_shares.go @@ -50,6 +50,17 @@ func DataSourceIbmIsShares() *schema.Resource { Computed: true, Description: "The access control mode for the share", }, + "allowed_access_protocols": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Allowed access protocols for this share", + }, + "bandwidth": { + Type: schema.TypeInt, + Computed: true, + Description: "The bandwidth for this share.", + }, "created_at": { Type: schema.TypeString, Computed: true, @@ -711,6 +722,12 @@ func dataSourceShareCollectionSharesToMap(meta interface{}, sharesItem vpcv1.Sha if !core.IsNil(sharesItem.AllowedTransitEncryptionModes) { sharesMap["allowed_transit_encryption_modes"] = sharesItem.AllowedTransitEncryptionModes } + if !core.IsNil(sharesItem.AllowedAccessProtocols) { + sharesMap["allowed_access_protocols"] = sharesItem.AllowedAccessProtocols + } + if sharesItem.Bandwidth != nil { + sharesMap["bandwidth"] = sharesItem.Bandwidth + } if sharesItem.AccessorBindingRole != nil { sharesMap["accessor_binding_role"] = sharesItem.AccessorBindingRole } diff --git a/ibm/service/vpc/resource_ibm_is_share_mount_target_test.go b/ibm/service/vpc/resource_ibm_is_share_mount_target_test.go index 833b0a2756..9ae3614bea 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target_test.go @@ -68,6 +68,31 @@ func TestAccIBMIsShareMountTargetTransitEncryptionBasic(t *testing.T) { }) } +func TestAccIBMIsShareMountTargetTransitEncryptionIpsec(t *testing.T) { + var conf vpcv1.ShareMountTarget + vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) + targetName := fmt.Sprintf("tf-target-%d", acctest.RandIntRange(10, 100)) + sname := fmt.Sprintf("tf-fs-name-%d", acctest.RandIntRange(10, 100)) + vniName := fmt.Sprintf("tf-fs-vni-%d", acctest.RandIntRange(10, 100)) + primaryIPName := fmt.Sprintf("tf-fs-pipname-%d", acctest.RandIntRange(10, 100)) + subnetName := fmt.Sprintf("tf-fs-subnetn-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmIsShareTargetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMIsShareTargetTransitEncryptionConfigIpsec(vpcname, sname, vniName, subnetName, primaryIPName, targetName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmIsShareTargetExists("ibm_is_share_mount_target.is_share_target", conf), + resource.TestCheckResourceAttr("ibm_is_share_mount_target.is_share_target", "name", targetName), + resource.TestCheckResourceAttr("ibm_is_share_mount_target.is_share_target", "transit_encryption", "user_managed"), + ), + }, + }, + }) +} + func TestAccIbmIsShareMountTargetVNISubnet(t *testing.T) { var conf vpcv1.ShareMountTarget vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) @@ -507,7 +532,45 @@ func testAccCheckIBMIsShareTargetTransitEncryptionConfigBasic(vpcName, sname, vn } resource "ibm_is_share_mount_target" "is_share_target" { share = ibm_is_share.is_share.id - transit_encryption = "user_managed" + transit_encryption = "ipsec" + virtual_network_interface { + name = "%s" + primary_ip { + name = "%s" + } + subnet = ibm_is_subnet.testacc_subnet.id + } + name = "%s" + } + `, sname, acc.ShareProfileName, vpcName, subnetName, acc.ISCIDR, vniName, primaryIPName, targetName) +} + +func testAccCheckIBMIsShareTargetTransitEncryptionConfigIpsec(vpcName, sname, vniName, subnetName, primaryIPName, targetName string) string { + return fmt.Sprintf(` + data "ibm_resource_group" "group" { + is_default = "true" + } + resource "ibm_is_share" "is_share" { + access_control_mode = "security_group" + allowed_access_protocols = ["nfs4] + zone = "us-south-1" + size = 200 + name = "%s" + profile = "%s" + } + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "us-south-1" + ipv4_cidr_block = "%s" + } + resource "ibm_is_share_mount_target" "is_share_target" { + share = ibm_is_share.is_share.id + transit_encryption = "ipsec" + access_protocol = "nfs4" virtual_network_interface { name = "%s" primary_ip { diff --git a/ibm/service/vpc/resource_ibm_is_share_snapshot.go b/ibm/service/vpc/resource_ibm_is_share_snapshot.go index 13dcc0b4f5..1960fd5ce8 100644 --- a/ibm/service/vpc/resource_ibm_is_share_snapshot.go +++ b/ibm/service/vpc/resource_ibm_is_share_snapshot.go @@ -689,7 +689,7 @@ func ResourceIBMIsShareSnapshotShareSnapshotStatusReasonToMap(model *vpcv1.Share return modelMap, nil } -func ResourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { +func ResourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name diff --git a/ibm/service/vpc/resource_ibm_is_share_test.go b/ibm/service/vpc/resource_ibm_is_share_test.go index c4ee7f2d14..a8942ce259 100644 --- a/ibm/service/vpc/resource_ibm_is_share_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_test.go @@ -264,6 +264,35 @@ func TestAccIbmIsShareVNIID(t *testing.T) { }) } +func TestAccIbmIsRegionalShare(t *testing.T) { + var conf vpcv1.Share + + name := fmt.Sprintf("tf-fs-name-%d", acctest.RandIntRange(10, 100)) + subnetName := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + shareTargetName := fmt.Sprintf("tf-fs-tg-name-%d", acctest.RandIntRange(10, 100)) + vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) + vniname := fmt.Sprintf("tf-vni-%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmIsShareDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmIsRegionalShareConfig(vpcname, subnetName, shareTargetName, vniname, name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmIsShareExists("ibm_is_share.is_share", conf), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "name", name), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "id"), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "mount_targets.0.virtual_network_interface.0.id"), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "mount_targets.0.access_protocol", "nfs4"), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "mount_targets.0.virtual_network_interface.0.name"), + ), + }, + }, + }) +} + func TestAccIbmIsShareOriginShare(t *testing.T) { var conf vpcv1.Share @@ -396,6 +425,43 @@ func testAccCheckIbmIsShareConfigVNIID(vpcName, sname, targetName, vniName, shar `, vpcName, sname, acc.ISCIDR, vniName, shareName, targetName) } +func testAccCheckIbmIsRegionalShareConfig(vpcName, sname, targetName, vniName, shareName string) string { + return fmt.Sprintf(` + data "ibm_resource_group" "group" { + is_default = "true" + } + resource "ibm_is_vpc" "testacc_vpc" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc.id + zone = "us-south-1" + ipv4_cidr_block = "%s" + } + resource "ibm_is_virtual_network_interface" "testacc_vni"{ + name = "%s" + subnet = ibm_is_subnet.testacc_subnet.id + } + resource "ibm_is_share" "is_share" { + access_control_mode = "security_group" + allowed_access_protocols = "nfs4" + zone = "us-south-1" + size = 220 + name = "%s" + profile = "rfs" + mount_targets { + transit_encryption = "ipsec" + access_protocol = "nfs4" + name = "%s" + virtual_network_interface { + id = ibm_is_virtual_network_interface.testacc_vni.id + } + } + } + `, vpcName, sname, acc.ISCIDR, vniName, shareName, targetName) +} + func testAccCheckIbmIsShareConfigOriginShareConfig(vpcName, sname, tEMode, shareName, shareName1 string) string { return fmt.Sprintf(` diff --git a/website/docs/d/is_share.html.markdown b/website/docs/d/is_share.html.markdown index 00aba29562..4ef29f9adf 100644 --- a/website/docs/d/is_share.html.markdown +++ b/website/docs/d/is_share.html.markdown @@ -52,6 +52,8 @@ The following attributes are exported: - `id` - (String) The unique identifier for this share accessor binding. - `resource_type` - (String) The resource type. - `allowed_transit_encryption_modes` - (List of string) The transit encryption modes allowed for this share. +- `allowed_access_protocols` - (List of string) Allowed access protocols for the share. +- `bandwidth` - (Integer) Bandwidth of the share - `access_tags` - (String) Access management tags associated to the share. - `created_at` - The date and time that the file share is created. - `crn` - The CRN for this share. diff --git a/website/docs/d/is_shares.html.markdown b/website/docs/d/is_shares.html.markdown index a3ea8acfab..20c6d341bb 100644 --- a/website/docs/d/is_shares.html.markdown +++ b/website/docs/d/is_shares.html.markdown @@ -37,6 +37,8 @@ The following attributes are exported: - `id` - (String) The unique identifier for this share accessor binding. - `resource_type` - (String) The resource type. - `allowed_transit_encryption_modes` - (List of string) The transit encryption modes allowed for this share. + - `allowed_access_protocols` - (List of string) Allowed access protocols for the share. + - `bandwidth` - (Integer) Bandwidth of the share - `created_at` - The date and time that the file share is created. - `crn` - The CRN for this share. - `encryption` - The type of encryption used for this file share. From 09f32e85e5ff9b30820ded95d28bca2c971e606b Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 14 May 2025 10:27:20 +0530 Subject: [PATCH 03/13] updates to shares --- ibm/service/vpc/data_source_ibm_is_share_snapshot.go | 2 +- ibm/service/vpc/data_source_ibm_is_share_snapshots.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshot.go b/ibm/service/vpc/data_source_ibm_is_share_snapshot.go index 96a57ef16d..6295b33a81 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshot.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshot.go @@ -429,7 +429,7 @@ func DataSourceIBMIsShareSnapshotShareSnapshotStatusReasonToMap(model *vpcv1.Sha return modelMap, nil } -func DataSourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { +func DataSourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshots.go b/ibm/service/vpc/data_source_ibm_is_share_snapshots.go index 2cd2d866ae..a48c39808f 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshots.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshots.go @@ -446,7 +446,7 @@ func DataSourceIBMIsShareSnapshotsShareSnapshotStatusReasonToMap(model *vpcv1.Sh return modelMap, nil } -func DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { +func DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name From 7b4d3024a535893a0022e175842e9ee0d625bbbb Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 14 May 2025 10:30:15 +0530 Subject: [PATCH 04/13] updates to shares --- ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go | 2 +- ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go | 4 ++-- ibm/service/vpc/resource_ibm_is_share_snapshot_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go b/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go index 94e1c41b0a..9a6bfda4cd 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go @@ -270,7 +270,7 @@ func TestDataSourceIBMIsShareSnapshotZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ZoneReference) + model := new(vpcv1.ShareSnapshotZone) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go b/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go index 766463f131..8904406a49 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go @@ -189,7 +189,7 @@ func TestDataSourceIBMIsShareSnapshotsShareSnapshotToMap(t *testing.T) { shareSnapshotStatusReasonModel.Message = core.StringPtr("testString") shareSnapshotStatusReasonModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys") - zoneReferenceModel := new(vpcv1.ZoneReference) + zoneReferenceModel := new(vpcv1.ShareSnapshotZone) zoneReferenceModel.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") zoneReferenceModel.Name = core.StringPtr("us-south-1") @@ -369,7 +369,7 @@ func TestDataSourceIBMIsShareSnapshotsZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ZoneReference) + model := new(vpcv1.ShareSnapshotZone) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") diff --git a/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go b/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go index f297a84024..a55c15bb62 100644 --- a/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go @@ -313,7 +313,7 @@ func TestResourceIBMIsShareSnapshotZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ZoneReference) + model := new(vpcv1.ShareSnapshotZone) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") From c892d5b90078d0c4dead58b2b344ea650941d53f Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Wed, 9 Jul 2025 19:46:39 +0530 Subject: [PATCH 05/13] handle breaking change: transit encryption default values based on profiles --- .../vpc/resource_ibm_is_share_mount_target.go | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_share_mount_target.go b/ibm/service/vpc/resource_ibm_is_share_mount_target.go index 8b795049fd..89b2bccfc8 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -367,12 +367,22 @@ func resourceIBMIsShareMountTargetCreate(context context.Context, d *schema.Reso } shareMountTargetPrototype.TransitEncryption = &transitEncryption } else { - if _, ok := d.GetOk("vpc"); ok { - shareMountTargetPrototype.TransitEncryption = &[]string{"none"}[0] - } else { - shareMountTargetPrototype.TransitEncryption = &[]string{"ipsec"}[0] + getShareOptions := &vpcv1.GetShareOptions{ + ID: &shareId, + } + share, _, err := vpcClient.GetShareWithContext(context, getShareOptions) + if err != nil || share == nil { + tfErr := flex.TerraformErrorf(err, fmt.Sprintf("GetShareWithContext failed: %s", err.Error()), "ibm_is_share_mount_target", "create") + log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage()) + return tfErr.GetDiag() + } + if share != nil && share.Profile != nil && share.Profile.Name != nil { + if *share.Profile.Name == "dp2" { + shareMountTargetPrototype.TransitEncryption = &[]string{"ipsec"}[0] + } else if *share.Profile.Name == "rfs" { + shareMountTargetPrototype.TransitEncryption = &[]string{"stunnel"}[0] + } } - } createShareMountTargetOptions.ShareMountTargetPrototype = shareMountTargetPrototype shareTarget, response, err := vpcClient.CreateShareMountTargetWithContext(context, createShareMountTargetOptions) From 3bd6a2dff0a26bb4af95839625ea51d86040de8e Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Thu, 10 Jul 2025 09:54:18 +0530 Subject: [PATCH 06/13] doc update --- website/docs/r/is_share_mount_target.html.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index 9f021a60d3..10e2157e92 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -161,8 +161,11 @@ The following arguments are supported: ~> **Note** `virtual_network_interface` and `vpc` are mutually exclusive and one of them must be provided. - `name` - (Required, String) The user-defined name for this share target. Names must be unique within the share the share target resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. -- `transit_encryption` - (Required, String) The transit encryption mode for this share target. Supported values are **none**, **ipsec** and **stunnel** +- `transit_encryption` - (Optional, String) The transit encryption mode for this share target. Supported values are **none**, **ipsec** and **stunnel** + ~> **Note** + If `transit_encryption` is not provided, the default transit encryption for the corresponding share profile will be used + ## Attribute Reference The following attributes are exported: From 62487cd338bf382aed39fc9af33dada20a179004 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Wed, 17 Sep 2025 19:48:09 +0530 Subject: [PATCH 07/13] update document description --- ibm/service/vpc/resource_ibm_is_share.go | 2 +- website/docs/r/is_share.html.markdown | 1 + website/docs/r/is_share_mount_target.html.markdown | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 008c18b26e..5ad0806703 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -72,7 +72,7 @@ func ResourceIbmIsShare() *schema.Resource { Type: schema.TypeInt, Optional: true, Computed: true, - Description: "The initial group identifier for the file share.", + Description: "The bandwidth for the file share.", }, "encryption_key": { Type: schema.TypeString, diff --git a/website/docs/r/is_share.html.markdown b/website/docs/r/is_share.html.markdown index 3a2270aa4c..062ff6c043 100644 --- a/website/docs/r/is_share.html.markdown +++ b/website/docs/r/is_share.html.markdown @@ -130,6 +130,7 @@ The following arguments are supported: - `access_control_mode` - (Optional, Boolean) The access control mode for the share. Supported values are **security_group** and **vpc**. Default value is **security_group** - `allowed_transit_encryption_modes` - (Optional, List of string) The transit encryption modes allowed for this share. - `access_tags` - (Optional, List of Strings) The list of access management tags to attach to the share. **Note** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag). +- `bandwidth` - (Optional, Integer) The bandwidth for the file share - `encryption_key` - (Optional, String) 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 Service Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - `initial_owner` - (Optional, List) The initial owner for the file share. diff --git a/website/docs/r/is_share_mount_target.html.markdown b/website/docs/r/is_share_mount_target.html.markdown index 10e2157e92..fc491fb9b2 100644 --- a/website/docs/r/is_share_mount_target.html.markdown +++ b/website/docs/r/is_share_mount_target.html.markdown @@ -125,7 +125,7 @@ resource "ibm_is_share_mount_target" "mtarget1" { The following arguments are supported: - `share` - (Required, String) The file share identifier. -- `access_protocol` - (Required, String) The protocol to use to access the share for this share mount target. The specified value must be listed in the share's allowed_access_protocols. Available values are `nfs4` +- `access_protocol` - (Optional, String) The protocol to use to access the share for this share mount target. The specified value must be listed in the share's allowed_access_protocols. Available values are `nfs4` - `virtual_network_interface` (Optional, List) The virtual network interface for this share mount target. Required if the share's `access_control_mode` is `security_group`. - `name` - (Required, String) Name for this virtual network interface. The name must not be used by another virtual network interface in the VPC. Nested scheme for `virtual_network_interface`: From 73d19d6aba0e8b01adcb72a6f855b01169a9f88b Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Wed, 17 Sep 2025 22:33:39 +0530 Subject: [PATCH 08/13] updated SDK --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 29695 +++++++++------- 1 file changed, 16692 insertions(+), 13003 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 a2d9e269b6..bd15339f69 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.104.0-b4a47c49-20250418-184351 + * IBM OpenAPI SDK Code Generator Version: 3.107.0-b68ebf7a-20250811-145645 */ // 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: 2025-04-08 +// API Version: 2025-08-26 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 `2025-04-08` - // and `2025-05-02`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2025-08-26` + // and `2025-09-17`. Version *string } @@ -67,8 +67,8 @@ type VpcV1Options struct { // `2`. Generation *int64 - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2025-04-08` - // and `2025-05-02`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2025-08-26` + // and `2025-09-17`. Version *string } @@ -131,11 +131,9 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { return } } - if options.Version == nil { - options.Version = core.StringPtr("2025-04-22") + options.Version = core.StringPtr("2025-09-17") } - service = &VpcV1{ Service: baseService, Generation: options.Generation, @@ -221,76 +219,58 @@ 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. -// -// The system will automatically create the following additional resources for the VPC: -// - Unless `address_prefix_management` is `manual`, a [default address -// prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for each zone -// - A [default network -// ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl) -// - A [default routing -// table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table) -// - A [default security -// group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group). -func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +// 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 } -// 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") +// 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.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, 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 createVPCOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBackupPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } - if createVPCOptions.Dns != nil { - body["dns"] = createVPCOptions.Dns + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) } - if createVPCOptions.Name != nil { - body["name"] = createVPCOptions.Name + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) } - if createVPCOptions.ResourceGroup != nil { - body["resource_group"] = createVPCOptions.ResourceGroup + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) } request, err := builder.Build() @@ -302,12 +282,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_backup_policies", 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, UnmarshalBackupPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -318,47 +298,43 @@ 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) +// 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 } -// 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") +// 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(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") 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, `/backup_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -367,20 +343,7 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV 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) + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -395,12 +358,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_backup_policy", 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, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -411,72 +374,76 @@ 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. -// -// 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) +// 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 } -// 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") +// 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(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + "backup_policy_id": *listBackupPolicyJobsOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings`, 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 createVPCDnsResolutionBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.Name + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + 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() @@ -488,12 +455,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, "list_backup_policy_jobs", 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, UnmarshalBackupPolicyJobCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -504,87 +471,54 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, 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 *CreateVPCRouteResponse, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +// 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 } -// 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 *CreateVPCRouteResponse, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions 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(createVPCRouteOptions, "createVPCRouteOptions") + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.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, `/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 createVPCRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -594,12 +528,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_backup_policy_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateVPCRouteResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -610,87 +544,54 @@ 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. -// -// 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) +// 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 } -// 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") +// 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(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, + "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, `/vpcs/{vpc_id}/routing_tables`, 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 createVPCRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) } request, err := builder.Build() @@ -702,12 +603,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_backup_policy_plans", 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, UnmarshalBackupPolicyPlanCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -718,48 +619,53 @@ 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) +// 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 } -// 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") +// 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(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") 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, + "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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, 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 createVPCRoutingTableRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -769,26 +675,29 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags } - if createVPCRoutingTableRouteOptions.Advertise != nil { - body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority + 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 { @@ -805,12 +714,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, "create_backup_policy_plan", 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, UnmarshalBackupPolicyPlan) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -821,59 +730,57 @@ 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, 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 +// 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. // -// 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) +// 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 } -// 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") +// 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(deleteVPCOptions, "deleteVPCOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.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, `/vpcs/{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 deleteVPCOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -885,60 +792,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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.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, `/vpcs/{vpc_id}/address_prefixes/{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 deleteVPCAddressPrefixOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -949,67 +865,84 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.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}/dns_resolution_bindings/{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 deleteVPCDnsResolutionBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { 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()) @@ -1019,12 +952,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, "update_backup_policy_plan", 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, UnmarshalBackupPolicyPlan) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1035,52 +968,55 @@ 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) +// 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 } -// 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") +// 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(deleteVPCRouteOptions, "deleteVPCRouteOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, + "id": *deleteBackupPolicyOptions.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) + _, 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 deleteVPCRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { 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)) @@ -1091,63 +1027,68 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.ID, + "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, `/vpcs/{vpc_id}/routing_tables/{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 deleteVPCRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBackupPolicyOptions.Headers { 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)) @@ -1158,127 +1099,153 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") 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, + "id": *updateBackupPolicyOptions.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, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBackupPolicyOptions.Headers { 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 } - 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_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 } -// 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) +// 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 } -// 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") +// 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": *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) + _, 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 getVPCOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { 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 { @@ -1289,12 +1256,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, "list_bare_metal_server_profiles", 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, UnmarshalBareMetalServerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1305,47 +1272,46 @@ 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) +// 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 } -// 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") +// 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(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, + "name": *getBareMetalServerProfileOptions.Name, } 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, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -1362,12 +1328,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_bare_metal_server_profile", 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, UnmarshalBareMetalServerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1378,53 +1344,73 @@ 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) +// 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 } -// 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") +// 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": *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) + _, 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 getVPCDefaultNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServersOptions.Headers { 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.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)) + } + 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 { @@ -1435,12 +1421,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_bare_metal_servers", 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, UnmarshalBareMetalServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1451,55 +1437,60 @@ 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) +// 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. +// +// For this request to succeed, the properties in the request must adhere to the source image's `allowed_use` property. +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 } -// 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") +// 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(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") 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 := 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, `/bare_metal_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -1509,12 +1500,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_bare_metal_server", 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, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1525,54 +1516,71 @@ 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) +// 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. 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, "") 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") +// 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(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.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, `/vpcs/{id}/default_security_group`, pathParamsMap) + _, 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 getVPCDefaultSecurityGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -1582,12 +1590,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, "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, UnmarshalDefaultSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1598,47 +1606,47 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get 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) +// 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 } -// 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") +// 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(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, - "id": *getVPCDnsResolutionBindingOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings/{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 getVPCDnsResolutionBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -1655,12 +1663,12 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(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_dns_resolution_binding", 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, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1671,50 +1679,47 @@ 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 *GetVPCRouteResponse, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +// 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 } -// 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 *GetVPCRouteResponse, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions 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(getVPCRouteOptions, "getVPCRouteOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.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, `/vpcs/{vpc_id}/routes/{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 getVPCRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -1731,12 +1736,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, "get_bare_metal_server_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalGetVPCRouteResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1747,54 +1752,61 @@ 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) +// 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 } -// 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") +// 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(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, + "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, `/vpcs/{vpc_id}/routing_tables/{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 getVPCRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -1804,12 +1816,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, "update_bare_metal_server_disk", 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, UnmarshalBareMetalServerDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1820,54 +1832,65 @@ 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) +// 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 } -// 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") +// 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(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") 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, + "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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{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 getVPCRoutingTableRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { 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 { @@ -1878,12 +1901,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, "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, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1894,57 +1917,60 @@ 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) +// 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 } -// 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") +// 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(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + "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, `/vpcs/{vpc_id}/address_prefixes`, 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 listVPCAddressPrefixesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -1956,12 +1982,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, "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, UnmarshalAddressPrefixCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1972,88 +1998,55 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC 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`. +// 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 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) +// 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 } -// 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") +// 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(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + "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, `/vpcs/{vpc_id}/dns_resolution_bindings`, 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 listVPCDnsResolutionBindingsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { 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 { @@ -2061,85 +2054,63 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(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_vpc_dns_resolution_bindings", 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, UnmarshalVpcdnsResolutionBindingCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listVPCRoutesOptions, "listVPCRoutesOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, + "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, `/vpcs/{vpc_id}/routes`, 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 listVPCRoutesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { 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 { @@ -2150,12 +2121,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_bare_metal_server_network_attachment", 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, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2166,62 +2137,61 @@ 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) +// 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 } -// 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") +// 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(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") 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, + "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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, 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 listVPCRoutingTableRoutesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2233,12 +2203,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_bare_metal_server_network_attachment", 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, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2249,63 +2219,64 @@ 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) +// 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 } -// 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") +// 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(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, + "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, `/vpcs/{vpc_id}/routing_tables`, 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 listVPCRoutingTablesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { 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 listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) } request, err := builder.Build() @@ -2317,12 +2288,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_bare_metal_server_network_interfaces", 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, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2333,56 +2304,66 @@ 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/vpcs`, nil) + _, 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 listVpcsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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)) - } - 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)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2394,12 +2375,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_bare_metal_server_network_interface", 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, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2410,145 +2391,127 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List 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) +// 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 } -// 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") +// 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(updateVPCOptions, "updateVPCOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.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/{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 updateVPCOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc", 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, 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) +// 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 } -// 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") +// 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(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.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) + _, 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 updateVPCAddressPrefixOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -2558,12 +2521,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, "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, UnmarshalAddressPrefix) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2574,49 +2537,53 @@ 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) +// 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 } -// 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") +// 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(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, + "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, `/vpcs/{vpc_id}/dns_resolution_bindings/{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 updateVPCDnsResolutionBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -2625,7 +2592,7 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2640,12 +2607,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, "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, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2656,65 +2623,54 @@ 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 *UpdateVPCRouteResponse, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +// 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 } -// 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 *UpdateVPCRouteResponse, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions 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(updateVPCRouteOptions, "updateVPCRouteOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.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, `/vpcs/{vpc_id}/routes/{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 updateVPCRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -2724,12 +2680,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_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, UnmarshalUpdateVPCRouteResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2740,148 +2696,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) +// 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 } -// 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") +// 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(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.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, `/vpcs/{vpc_id}/routing_tables/{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 updateVPCRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_routing_table", 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, 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) +// 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 } -// 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") +// 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(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") 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, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.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}/routing_tables/{routing_table_id}/routes/{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 updateVPCRoutingTableRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -2891,12 +2819,12 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd 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()) + 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, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2907,58 +2835,63 @@ 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) +// 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 } -// 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") +// 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(createSubnetOptions, "createSubnetOptions") + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") 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": *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, `/subnets`, 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 createSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -2968,12 +2901,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, "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, UnmarshalSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2984,74 +2917,57 @@ 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) +// 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 } -// 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") +// 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(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, } - 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/{subnet_id}/reserved_ips`, 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 createSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -3061,12 +2977,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, "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, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3077,52 +2993,54 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS 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) +// 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 } -// 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") +// 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(deleteSubnetOptions, "deleteSubnetOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSubnetOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.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}`, 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 deleteSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -3133,61 +3051,66 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio 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", 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, UnmarshalReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + 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 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) +// 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 } -// 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") +// 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(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") 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": *deleteBareMetalServerOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -3202,7 +3125,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, "delete_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -3210,46 +3133,46 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS 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) +// 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 } -// 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") +// 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(getSubnetOptions, "getSubnetOptions") + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, + "id": *getBareMetalServerOptions.ID, } 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, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -3266,12 +3189,12 @@ 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, "get_bare_metal_server", 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, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3282,53 +3205,64 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge 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) +// 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. +// +// For this request to succeed, the properties in the request must adhere to the `allowed_use` property of the disk +// referenced in the server's `boot_target`. +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 } -// 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") +// 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(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetNetworkACLOptions.ID, + "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, `/subnets/{id}/network_acl`, 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 getSubnetNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -3338,12 +3272,12 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet_network_acl", 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, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3354,119 +3288,121 @@ 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) +// 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 } -// 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") +// 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(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + err = core.ValidateStruct(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, + "id": *updateFirmwareForBareMetalServerOptions.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, `/subnets/{id}/public_gateway`, 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 getSubnetPublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 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 } - 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_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_firmware_for_bare_metal_server", 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) +// 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 } -// 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") +// 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(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") 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": *getBareMetalServerInitializationOptions.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) + _, 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 getSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -3483,12 +3419,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, "get_bare_metal_server_initialization", 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, UnmarshalBareMetalServerInitialization) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3499,53 +3435,77 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR 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) +// 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. +// +// For this request to succeed, the properties of the server which would result from the reinitialization must adhere to +// the specified image's `allowed_use` property. +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 } -// 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") +// 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(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + err = core.ValidateStruct(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.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, `/subnets/{id}/routing_table`, 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 getSubnetRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceBareMetalServerInitialization") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range replaceBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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.DefaultTrustedProfile != nil { + body["default_trusted_profile"] = replaceBareMetalServerInitializationOptions.DefaultTrustedProfile + } + 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()) @@ -3555,12 +3515,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, "replace_bare_metal_server_initialization", 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, UnmarshalBareMetalServerInitialization) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3571,74 +3531,52 @@ 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) +// RestartBareMetalServer : Restart a bare metal 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, "") 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") +// 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(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + "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, `/subnets/{subnet_id}/reserved_ips`, 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 listSubnetReservedIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range restartBareMetalServerOptions.Headers { 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 { @@ -3646,90 +3584,61 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn 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_subnet_reserved_ips", getServiceComponentInfo()) + 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, UnmarshalReservedIPCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/subnets`, nil) + _, 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 listSubnetsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range startBareMetalServerOptions.Headers { 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 { @@ -3737,74 +3646,69 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions 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_subnets", getServiceComponentInfo()) + 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, 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) +// 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 } -// 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") +// 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(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, + "id": *stopBareMetalServerOptions.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, `/subnets/{id}/network_acl`, 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 replaceSubnetNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range stopBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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) + 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 @@ -3816,80 +3720,59 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac 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, "replace_subnet_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "stop_bare_metal_server", 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) +// 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 } -// 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") +// 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 } - pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.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}/routing_table`, pathParamsMap) + _, 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 replaceSubnetRoutingTableOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listClusterNetworkProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listClusterNetworkProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start)) + } + if listClusterNetworkProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.Limit)) } request, err := builder.Build() @@ -3901,12 +3784,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_cluster_network_profiles", 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, UnmarshalClusterNetworkProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3917,61 +3800,53 @@ 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) +// 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 } -// 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") +// 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(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + err = core.ValidateStruct(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, + "name": *getClusterNetworkProfileOptions.Name, } - 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, `/cluster_network/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getClusterNetworkProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -3981,12 +3856,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, "get_cluster_network_profile", 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, UnmarshalClusterNetworkProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3997,51 +3872,69 @@ 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) +// 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 } -// 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") +// 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 } - pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.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, `/cluster_networks`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworks") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listClusterNetworksOptions.Headers { 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 { @@ -4049,66 +3942,91 @@ 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, "list_cluster_networks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkCollection) + 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) +// 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 } -// 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") +// 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(updateSubnetOptions, "updateSubnetOptions") + err = core.ValidateStruct(createClusterNetworkOptions, "createClusterNetworkOptions") 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 := core.NewRequestBuilder(core.POST) 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, `/cluster_networks`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetwork") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createClusterNetworkOptions.Headers { 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(updateSubnetOptions.SubnetPatch) + 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 @@ -4123,12 +4041,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, "create_cluster_network", 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, UnmarshalClusterNetwork) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4139,62 +4057,68 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio 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. +// 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. // -// 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) +// 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 } -// 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") +// 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(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") + err = core.ValidateStruct(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *updateSubnetReservedIPOptions.SubnetID, - "id": *updateSubnetReservedIPOptions.ID, + "cluster_network_id": *listClusterNetworkInterfacesOptions.ClusterNetworkID, } - 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/{subnet_id}/reserved_ips/{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 updateSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listClusterNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -4206,12 +4130,12 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_subnet_reserved_ip", 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, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4222,45 +4146,48 @@ 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) +// 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 } -// 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") +// 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(createImageOptions, "createImageOptions") + err = core.ValidateStruct(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID, + } + 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, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -4269,7 +4196,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 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 @@ -4284,12 +4221,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_cluster_network_interface", 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, UnmarshalClusterNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4300,73 +4237,59 @@ 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) +// 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 } -// 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") +// 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(createImageExportJobOptions, "createImageExportJobOptions") + err = core.ValidateStruct(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.ImageID, + "cluster_network_id": *deleteClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *deleteClusterNetworkInterfaceOptions.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, `/images/{image_id}/export_jobs`, 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 createImageExportJobOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "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)) - 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()) @@ -4376,12 +4299,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, "delete_cluster_network_interface", 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, UnmarshalClusterNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4392,53 +4315,50 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma return } -// DeleteImage : Delete an image -// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be -// reversed. An image with an `owner_type` of `provider` 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) +// 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 } -// 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") +// 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(deleteImageOptions, "deleteImageOptions") + err = core.ValidateStruct(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteImageOptions.ID, + "cluster_network_id": *getClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *getClusterNetworkInterfaceOptions.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/{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 deleteImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -4449,134 +4369,169 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions 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", 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, UnmarshalClusterNetworkInterface) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + 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) { - response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +// 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 } -// 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") +// 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(deleteImageExportJobOptions, "deleteImageExportJobOptions") + err = core.ValidateStruct(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.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, `/images/{image_id}/export_jobs/{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 deleteImageExportJobOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateClusterNetworkInterfaceOptions.Headers { 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_image_export_job", 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 } -// 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 -// -// An image with an `owner_type` of `provider` is not allowed to be deprecated. -func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +// 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 } -// 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") +// 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(deprecateImageOptions, "deprecateImageOptions") + err = core.ValidateStruct(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deprecateImageOptions.ID, + "cluster_network_id": *listClusterNetworkSubnetsOptions.ClusterNetworkID, } - 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}/deprecate`, 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 deprecateImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listClusterNetworkSubnetsOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") 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 { @@ -4584,63 +4539,81 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO 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, "deprecate_image", 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, UnmarshalClusterNetworkSubnetCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getImageOptions, "getImageOptions") + err = core.ValidateStruct(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, + "cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID, } - 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, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -4650,12 +4623,12 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_image", 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, UnmarshalImage) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4666,53 +4639,65 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI 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) +// 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 } -// 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") +// 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(getImageExportJobOptions, "getImageExportJobOptions") + err = core.ValidateStruct(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, + "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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, 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 getImageExportJobOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listClusterNetworkSubnetReservedIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listClusterNetworkSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start)) + } + if listClusterNetworkSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit)) + } + 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() if err != nil { @@ -4723,12 +4708,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_cluster_network_subnet_reserved_ips", 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, UnmarshalClusterNetworkSubnetReservedIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4739,53 +4724,70 @@ 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) +// 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 } -// 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") +// 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(getOperatingSystemOptions, "getOperatingSystemOptions") + err = core.ValidateStruct(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, + "cluster_network_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, } - 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, `/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 getOperatingSystemOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createClusterNetworkSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 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 + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -4795,12 +4797,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_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4811,60 +4813,60 @@ 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. +// DeleteClusterNetworkSubnetReservedIP : Delete a cluster network subnet reserved IP +// This request deletes a cluster network subnet reserved IP. This operation cannot be reversed. // -// 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) +// 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 } -// 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") +// 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(listImageExportJobsOptions, "listImageExportJobsOptions") + err = core.ValidateStruct(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *listImageExportJobsOptions.ImageID, + "cluster_network_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, + "id": *deleteClusterNetworkSubnetReservedIPOptions.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, `/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 listImageExportJobsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteClusterNetworkSubnetReservedIPOptions.Headers { 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)) - if listImageExportJobsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -4875,12 +4877,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, "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, UnmarshalImageExportJobUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4891,68 +4893,54 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE 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) +// 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 } -// 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") +// 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(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "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, `/images`, nil) + _, 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 listImagesOptions.Headers { - builder.AddHeader(headerName, headerValue) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getClusterNetworkSubnetReservedIPOptions.Headers { 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)) - } - if listImagesOptions.UserDataFormat != nil { - builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) - } - if listImagesOptions.OwnerType != nil { - builder.AddQuery("owner_type", fmt.Sprint(*listImagesOptions.OwnerType)) - } request, err := builder.Build() if err != nil { @@ -4963,12 +4951,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_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4979,48 +4967,65 @@ 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) +// 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 } -// 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") +// 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(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions") 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": *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, `/operating_systems`, nil) + _, 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 listOperatingSystemsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateClusterNetworkSubnetReservedIPOptions.Headers { 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)) - 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(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -5032,12 +5037,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_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5048,57 +5053,55 @@ 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 +// DeleteClusterNetworkSubnet : Delete a cluster network subnet +// This request deletes a cluster network subnet. This operation cannot be reversed. // -// An image with an `owner_type` of `provider` is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +// 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 } -// 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") +// 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(obsoleteImageOptions, "obsoleteImageOptions") + err = core.ValidateStruct(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.ID, + "cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *deleteClusterNetworkSubnetOptions.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, `/images/{id}/obsolete`, 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 obsoleteImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteClusterNetworkSubnetOptions.Headers { 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)) @@ -5109,72 +5112,73 @@ 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, "delete_cluster_network_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + 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 } -// 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. An image with an `owner_type` of -// `provider` 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) +// 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 } -// 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") +// 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(updateImageOptions, "updateImageOptions") + err = core.ValidateStruct(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateImageOptions.ID, + "cluster_network_id": *getClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *getClusterNetworkSubnetOptions.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/{id}`, 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 updateImageOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -5184,12 +5188,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_cluster_network_subnet", 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, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5200,58 +5204,61 @@ 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) +// 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 } -// 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") +// 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(updateImageExportJobOptions, "updateImageExportJobOptions") + err = core.ValidateStruct(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *updateImageExportJobOptions.ImageID, - "id": *updateImageExportJobOptions.ID, + "cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *updateClusterNetworkSubnetOptions.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) + _, 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 updateImageExportJobOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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(updateImageExportJobOptions.ImageExportJobPatch) + _, err = builder.SetBodyContentJSON(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -5266,12 +5273,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, "update_cluster_network_subnet", 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, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5282,71 +5289,58 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma 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) +// 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 } -// 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") +// 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(createKeyOptions, "createKeyOptions") + err = core.ValidateStruct(deleteClusterNetworkOptions, "deleteClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteClusterNetworkOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + _, 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 createKeyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetwork") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "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)) - 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()) @@ -5356,12 +5350,12 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_key", 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, UnmarshalKey) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5372,48 +5366,49 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr 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) +// 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 } -// 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") +// 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(deleteKeyOptions, "deleteKeyOptions") + err = core.ValidateStruct(getClusterNetworkOptions, "getClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteKeyOptions.ID, + "id": *getClusterNetworkOptions.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, `/keys/{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 deleteKeyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -5424,63 +5419,84 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *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_key", 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, UnmarshalClusterNetwork) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getKeyOptions, "getKeyOptions") + err = core.ValidateStruct(updateClusterNetworkOptions, "updateClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getKeyOptions.ID, + "id": *updateClusterNetworkOptions.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, `/keys/{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 getKeyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetwork") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateClusterNetworkOptions.Headers { 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(updateClusterNetworkOptions.ClusterNetworkPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -5490,12 +5506,12 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_key", 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, UnmarshalKey) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5506,18 +5522,18 @@ 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) +// ListDedicatedHostGroups : List dedicated host groups +// 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, "") 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") +// 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 @@ -5526,32 +5542,38 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, 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 listKeysOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { 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 listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) } - if listKeysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) } - if listKeysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.ResourceGroupID)) + 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() @@ -5563,12 +5585,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, "list_dedicated_host_groups", 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, UnmarshalDedicatedHostGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5579,55 +5601,67 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List 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) +// 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 } -// 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") +// 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(updateKeyOptions, "updateKeyOptions") + err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") 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 := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + _, 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 updateKeyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { 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(updateKeyOptions.KeyPatch) + 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 @@ -5642,12 +5676,12 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_key", getServiceComponentInfo()) + 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, UnmarshalKey) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5658,58 +5692,48 @@ 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) +// 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 } -// 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") +// 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(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") 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, + "id": *deleteDedicatedHostGroupOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{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 addInstanceNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -5720,93 +5744,63 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(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, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_dedicated_host_group", 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 } -// 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) +// 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 } -// 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") +// 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(createClusterNetworkAttachmentOptions, "createClusterNetworkAttachmentOptions") + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createClusterNetworkAttachmentOptions.InstanceID, + "id": *getDedicatedHostGroupOptions.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}/cluster_network_attachments`, 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 createClusterNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -5816,12 +5810,12 @@ func (vpc *VpcV1) CreateClusterNetworkAttachmentWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_cluster_network_attachment", 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, UnmarshalInstanceClusterNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5832,53 +5826,57 @@ func (vpc *VpcV1) CreateClusterNetworkAttachmentWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(createInstanceOptions, "createInstanceOptions") + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/instances`, 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 createInstanceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { 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(createInstanceOptions.InstancePrototype) + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -5893,12 +5891,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, "update_dedicated_host_group", 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, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5909,66 +5907,49 @@ 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) +// 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 } -// 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") +// 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{ - "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, `/dedicated_host/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceActionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) } request, err := builder.Build() @@ -5980,12 +5961,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_dedicated_host_profiles", 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, UnmarshalDedicatedHostProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5996,70 +5977,53 @@ 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) +// 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 } -// 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") +// 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(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + "name": *getDedicatedHostProfileOptions.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, `/instances/{instance_id}/console_access_token`, pathParamsMap) + _, 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 createInstanceConsoleAccessTokenOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -6069,12 +6033,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_dedicated_host_profile", 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, UnmarshalDedicatedHostProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6085,67 +6049,60 @@ 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) +// 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 } -// 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") +// 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{ - "instance_id": *createInstanceNetworkAttachmentOptions.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_attachments`, 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 createInstanceNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listDedicatedHostsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.Name + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + 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() @@ -6157,12 +6114,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, "list_dedicated_hosts", 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, UnmarshalDedicatedHostCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6173,53 +6130,42 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(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) +// 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 } -// 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") +// 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(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") 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) + _, 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 createInstanceNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -6228,23 +6174,7 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, 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) + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -6259,12 +6189,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, "create_dedicated_host", 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, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6275,60 +6205,55 @@ 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) +// 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 } -// 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") +// 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(createInstanceTemplateOptions, "createInstanceTemplateOptions") + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/instance/templates`, 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 createInstanceTemplateOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -6338,12 +6263,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, "list_dedicated_host_disks", 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, UnmarshalDedicatedHostDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6354,73 +6279,54 @@ 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) +// 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 } -// 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") +// 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(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.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}/volume_attachments`, 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 createInstanceVolumeAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -6430,12 +6336,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, "get_dedicated_host_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, UnmarshalDedicatedHostDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6446,122 +6352,129 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(deleteInstanceOptions, "deleteInstanceOptions") + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceOptions.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, `/instances/{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 deleteInstanceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - if deleteInstanceOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteInstanceOptions.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(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 } - 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", 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, UnmarshalDedicatedHostDisk) + 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) +// DeleteDedicatedHost : Delete 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, "") 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") +// 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(deleteInstanceClusterNetworkAttachmentOptions, "deleteInstanceClusterNetworkAttachmentOptions") + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceClusterNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceClusterNetworkAttachmentOptions.ID, + "id": *deleteDedicatedHostOptions.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) + _, 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 deleteInstanceClusterNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -6572,71 +6485,59 @@ func (vpc *VpcV1) DeleteInstanceClusterNetworkAttachmentWithContext(ctx 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, "delete_instance_cluster_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_dedicated_host", 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 } -// 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) +// 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 } -// 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") +// 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(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") 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": *getDedicatedHostOptions.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, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -6647,131 +6548,175 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") 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": *updateDedicatedHostOptions.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, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "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 } - 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_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 } -// 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) +// 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. +// +// The endpoint gateways will be sorted by their `created_at` property values, with newest endpoint gateway first. +// Endpoint gateways with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +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 } -// 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") +// 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": *deleteInstanceTemplateOptions.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, `/endpoint_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { 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.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 { @@ -6779,126 +6724,179 @@ 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, "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 } -// 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) +// CreateEndpointGateway : Create an endpoint gateway +// This request creates a new endpoint gateway from an endpoint gateway prototype object. The prototype object is +// structured in the same way as a retrieved endpoint gateway, and contains the information necessary to create a new +// endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target service 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 } -// 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") +// 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(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") 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 := 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, `/endpoint_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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_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 } -// 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) +// 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 } -// 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") +// 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(getInstanceOptions, "getInstanceOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceOptions.ID, + "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, `/instances/{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 getInstanceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { 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 { @@ -6909,12 +6907,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, "list_endpoint_gateway_ips", 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, UnmarshalReservedIPCollectionEndpointGatewayContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6925,50 +6923,50 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions 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) +// 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 } -// 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") +// 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(getInstanceClusterNetworkAttachmentOptions, "getInstanceClusterNetworkAttachmentOptions") + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceClusterNetworkAttachmentOptions.InstanceID, - "id": *getInstanceClusterNetworkAttachmentOptions.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, `/instances/{instance_id}/cluster_network_attachments/{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 getInstanceClusterNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -6979,66 +6977,57 @@ func (vpc *VpcV1) GetInstanceClusterNetworkAttachmentWithContext(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, "get_instance_cluster_network_attachment", 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, UnmarshalInstanceClusterNetworkAttachment) - 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) +// 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 } -// 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") +// 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(getInstanceDiskOptions, "getInstanceDiskOptions") + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, + "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, `/instances/{instance_id}/disks/{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 getInstanceDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -7055,12 +7044,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_endpoint_gateway_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7071,47 +7060,50 @@ 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) +// 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 } -// 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") +// 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(getInstanceInitializationOptions, "getInstanceInitializationOptions") + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceInitializationOptions.ID, + "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, `/instances/{id}/initialization`, 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 getInstanceInitializationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -7128,12 +7120,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, "add_endpoint_gateway_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7144,50 +7136,51 @@ 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) +// 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 } -// 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") +// 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(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, + "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, `/instances/{instance_id}/network_attachments/{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 getInstanceNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -7198,70 +7191,56 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g 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_attachment", 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, 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) +// 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 } -// 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") +// 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(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, - "id": *getInstanceNetworkInterfaceOptions.ID, + "id": *getEndpointGatewayOptions.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) + _, 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 getInstanceNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -7278,12 +7257,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, "get_endpoint_gateway", 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, UnmarshalEndpointGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7294,56 +7273,62 @@ 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) +// UpdateEndpointGateway : Update an endpoint gateway +// This request updates an endpoint gateway with the information in a provided endpoint gateway patch. The endpoint +// gateway patch object is structured in the same way as a retrieved endpoint gateway and contains only the information +// to be updated. +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 } -// 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") +// 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(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") 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, + "id": *updateEndpointGatewayOptions.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}/floating_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 getInstanceNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -7353,12 +7338,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, "update_endpoint_gateway", 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, UnmarshalEndpointGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7369,57 +7354,68 @@ 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) +// 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 } -// 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") +// 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{ - "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) + _, 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 getInstanceNetworkInterfaceIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listFloatingIpsOptions.Headers { 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 { @@ -7430,12 +7426,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, 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()) + 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, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7446,53 +7442,56 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(getInstanceProfileOptions, "getInstanceProfileOptions") + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") 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, `/floating_ips`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -7502,12 +7501,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_floating_ip", 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, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7518,49 +7517,49 @@ 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) +// 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 } -// 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") +// 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(getInstanceTemplateOptions, "getInstanceTemplateOptions") + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, + "id": *deleteFloatingIPOptions.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/templates/{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 getInstanceTemplateOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -7571,66 +7570,56 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc 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_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_floating_ip", 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) +// 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 } -// 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") +// 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(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, + "id": *getFloatingIPOptions.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) + _, 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 getInstanceVolumeAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -7647,12 +7636,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, "get_floating_ip", 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, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7663,58 +7652,58 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge 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) +// 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 } -// 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") +// 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(listInstanceClusterNetworkAttachmentsOptions, "listInstanceClusterNetworkAttachmentsOptions") + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceClusterNetworkAttachmentsOptions.InstanceID, + "id": *updateFloatingIPOptions.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}/cluster_network_attachments`, 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 listInstanceClusterNetworkAttachmentsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceClusterNetworkAttachments") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 listInstanceClusterNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceClusterNetworkAttachmentsOptions.Start)) - } - if listInstanceClusterNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceClusterNetworkAttachmentsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -7726,12 +7715,12 @@ func (vpc *VpcV1) ListInstanceClusterNetworkAttachmentsWithContext(ctx context.C 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()) + 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, UnmarshalInstanceClusterNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7742,54 +7731,73 @@ func (vpc *VpcV1) ListInstanceClusterNetworkAttachmentsWithContext(ctx context.C 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) +// 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 TCP and UDP 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 } -// 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") +// 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 } - 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) + _, 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 listInstanceDisksOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { 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 { @@ -7800,12 +7808,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, "list_flow_log_collectors", 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, UnmarshalFlowLogCollectorCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7816,58 +7824,74 @@ 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. -// -// 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) +// 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 } -// 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") +// 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(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") 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 := 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) + _, 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 listInstanceNetworkAttachmentsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -7877,12 +7901,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, "create_flow_log_collector", 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, UnmarshalFlowLogCollector) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7893,50 +7917,50 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(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) +// 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 } -// 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") +// 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(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") 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, + "id": *deleteFlowLogCollectorOptions.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}/floating_ips`, 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 listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -7947,81 +7971,62 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx 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_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_flow_log_collector", 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) +// 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 } -// 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") +// 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(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") 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, + "id": *getFlowLogCollectorOptions.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`, 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 listInstanceNetworkInterfaceIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { 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 { @@ -8032,12 +8037,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, "get_flow_log_collector", 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, UnmarshalFlowLogCollector) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8048,60 +8053,62 @@ 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) +// 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 } -// 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") +// 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(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + "id": *updateFlowLogCollectorOptions.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`, 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 listInstanceNetworkInterfacesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -8111,12 +8118,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, "update_flow_log_collector", 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, UnmarshalFlowLogCollector) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8127,18 +8134,21 @@ 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) +// 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 } -// 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") +// 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 @@ -8147,18 +8157,18 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder := core.NewRequestBuilder(core.GET) 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, `/regions`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listRegionsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -8175,12 +8185,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, "list_regions", 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, UnmarshalRegionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8191,37 +8201,46 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta 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) +// 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 } -// 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") +// 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, `/instance/templates`, nil) + _, 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 listInstanceTemplatesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getRegionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -8238,12 +8257,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_region", 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, UnmarshalRegion) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8254,48 +8273,47 @@ 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) +// 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 } -// 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") +// 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(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + "region_name": *listRegionZonesOptions.RegionName, } 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, `/regions/{region_name}/zones`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listRegionZonesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -8312,12 +8330,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, "list_region_zones", 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, UnmarshalZoneCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8328,103 +8346,53 @@ 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) +// 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 } -// 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") +// 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, `/instances`, nil) + _, 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 listInstancesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getRegionZoneOptions.Headers { 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.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)) - } - 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.ReservationAffinityPolicy != nil { - builder.AddQuery("reservation_affinity.policy", fmt.Sprint(*listInstancesOptions.ReservationAffinityPolicy)) - } - 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 { @@ -8435,12 +8403,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, "get_region_zone", 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, UnmarshalZone) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8451,126 +8419,67 @@ 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) +// 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 } -// 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") +// 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{ - "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, `/images`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listImagesOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("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, "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 + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) } - - pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) } - - 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 + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) } - - for headerName, headerValue := range updateInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) } - 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)) + if listImagesOptions.UserDataFormat != nil { + builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) } - - 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 + if listImagesOptions.RemoteAccountID != nil { + builder.AddQuery("remote.account.id", fmt.Sprint(*listImagesOptions.RemoteAccountID)) } request, err := builder.Build() @@ -8582,12 +8491,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_images", 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, UnmarshalImageCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8598,58 +8507,54 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO 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) +// 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 } -// 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") +// 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(updateInstanceClusterNetworkAttachmentOptions, "updateInstanceClusterNetworkAttachmentOptions") + err = core.ValidateStruct(createImageOptions, "createImageOptions") 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 := 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/{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 updateInstanceClusterNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createImageOptions.Headers { 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(updateInstanceClusterNetworkAttachmentOptions.InstanceClusterNetworkAttachmentPatch) + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8664,12 +8569,12 @@ func (vpc *VpcV1) UpdateInstanceClusterNetworkAttachmentWithContext(ctx context. 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()) + core.EnrichHTTPProblem(err, "create_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8680,143 +8585,121 @@ func (vpc *VpcV1) UpdateInstanceClusterNetworkAttachmentWithContext(ctx context. 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) +// DeleteImage : Delete an image +// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be +// reversed. An image with `remote.account` set 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 } -// 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") +// 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(updateInstanceDiskOptions, "updateInstanceDiskOptions") + err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, + "id": *deleteImageOptions.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}/disks/{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 updateInstanceDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_image", 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) +// 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 } -// 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") +// 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(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getImageOptions, "getImageOptions") 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": *getImageOptions.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, `/images/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getImageOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -8826,12 +8709,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_image", 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, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8842,53 +8725,48 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context 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) +// 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. An image with `remote.account` set +// 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 } -// 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") +// 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(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, + "id": *updateImageOptions.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) + _, 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 updateInstanceNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateImageOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -8897,7 +8775,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8912,12 +8790,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, "update_image", 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, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8928,60 +8806,59 @@ 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) +// ListImageBareMetalServerProfiles : List bare metal server profiles compatible with an image +// This request lists bare metal server profiles compatible with an image's +// `allowed_use.bare_metal_server`, `operating_system.architecture` and +// `user_data_format` properties, sorted by ascending `name` property values. +func (vpc *VpcV1) ListImageBareMetalServerProfiles(listImageBareMetalServerProfilesOptions *ListImageBareMetalServerProfilesOptions) (result *ImageBareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImageBareMetalServerProfilesWithContext(context.Background(), listImageBareMetalServerProfilesOptions) 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") +// ListImageBareMetalServerProfilesWithContext is an alternate form of the ListImageBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListImageBareMetalServerProfilesWithContext(ctx context.Context, listImageBareMetalServerProfilesOptions *ListImageBareMetalServerProfilesOptions) (result *ImageBareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageBareMetalServerProfilesOptions, "listImageBareMetalServerProfilesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + err = core.ValidateStruct(listImageBareMetalServerProfilesOptions, "listImageBareMetalServerProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.ID, + "id": *listImageBareMetalServerProfilesOptions.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/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/bare_metal_server_profiles`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageBareMetalServerProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listImageBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + if listImageBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImageBareMetalServerProfilesOptions.Start)) + } + if listImageBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImageBareMetalServerProfilesOptions.Limit)) } request, err := builder.Build() @@ -8993,12 +8870,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, "list_image_bare_metal_server_profiles", 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, UnmarshalImageBareMetalServerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9009,62 +8886,60 @@ 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) +// 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 +// +// An image with `remote.account` set 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 } -// 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") +// 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(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") 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": *deprecateImageOptions.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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, 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 updateInstanceVolumeAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deprecateImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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 - } + builder.AddQuery("maturity", fmt.Sprint(*deprecateImageOptions.Maturity)) request, err := builder.Build() if err != nil { @@ -9072,98 +8947,69 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(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, "update_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "deprecate_image", 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) +// ListImageInstanceProfiles : List instance profiles compatible with an image +// This request lists instance profiles compatible with an image's +// `allowed_use.instance`, `operating_system.architecture` and +// `user_data_format` properties, sorted by ascending `name` property values. +func (vpc *VpcV1) ListImageInstanceProfiles(listImageInstanceProfilesOptions *ListImageInstanceProfilesOptions) (result *ImageInstanceProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImageInstanceProfilesWithContext(context.Background(), listImageInstanceProfilesOptions) 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") +// ListImageInstanceProfilesWithContext is an alternate form of the ListImageInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListImageInstanceProfilesWithContext(ctx context.Context, listImageInstanceProfilesOptions *ListImageInstanceProfilesOptions) (result *ImageInstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageInstanceProfilesOptions, "listImageInstanceProfilesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + err = core.ValidateStruct(listImageInstanceProfilesOptions, "listImageInstanceProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *listImageInstanceProfilesOptions.ID, + } + + 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.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/instance_profiles`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageInstanceProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listImageInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listImageInstanceProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImageInstanceProfilesOptions.Start)) } - 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 + if listImageInstanceProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImageInstanceProfilesOptions.Limit)) } request, err := builder.Build() @@ -9175,12 +9021,12 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_image_instance_profiles", 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, UnmarshalImageInstanceProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9191,59 +9037,61 @@ 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) +// 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 +// +// An image with `remote.account` set 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 } -// 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") +// 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(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + "id": *obsoleteImageOptions.ID, } 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) + _, 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 createInstanceGroupManagerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range obsoleteImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 - } + builder.AddQuery("maturity", fmt.Sprint(*obsoleteImageOptions.Maturity)) request, err := builder.Build() if err != nil { @@ -9251,78 +9099,69 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre 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, "obsolete_image", 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) +// 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 } -// 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") +// 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(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") 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, + "image_id": *listImageExportJobsOptions.ImageID, } - 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, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listImageExportJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + if listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) } request, err := builder.Build() @@ -9334,12 +9173,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, "list_image_export_jobs", 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, UnmarshalImageExportJobUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9350,47 +9189,49 @@ 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) +// 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 } -// 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") +// 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(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") 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, + "image_id": *createImageExportJobOptions.ImageID, } 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) + _, 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 createInstanceGroupManagerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -9399,7 +9240,17 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + 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 @@ -9414,12 +9265,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, "create_image_export_job", 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, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9430,47 +9281,49 @@ 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) +// 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 } -// 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") +// 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(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceGroupOptions.ID, + "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, `/instance_groups/{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 deleteInstanceGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -9485,7 +9338,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_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9493,48 +9346,50 @@ 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) +// 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 } -// 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") +// 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(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.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}/load_balancer`, 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 deleteInstanceGroupLoadBalancerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -9545,126 +9400,150 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") 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, + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.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}/managers/{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 deleteInstanceGroupManagerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "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 } - 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, "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 } -// 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) +// 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 } -// 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") +// 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{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.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, `/operating_systems`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listOperatingSystemsOptions.Headers { 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 { @@ -9672,60 +9551,68 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") 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, + "name": *getOperatingSystemOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{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 deleteInstanceGroupManagerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getOperatingSystemOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -9736,121 +9623,235 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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, "", "unexpected-nil-param", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + + 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, "", "struct-validation-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.ID, + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - builder := core.NewRequestBuilder(core.DELETE) + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + 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 +} + +// 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/{instance_group_id}/memberships/{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 deleteInstanceGroupMembershipOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + 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": *deleteInstanceGroupMembershipsOptions.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}/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 { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -9865,7 +9866,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_instance_group_memberships", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9907,12 +9908,12 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr return } - for headerName, headerValue := range getInstanceGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -9945,54 +9946,61 @@ 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) +// 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 } -// 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") +// 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(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + 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": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, + "id": *updateInstanceGroupOptions.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/{id}`, 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 getInstanceGroupManagerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -10002,12 +10010,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group_manager", 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, UnmarshalInstanceGroupManager) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10018,51 +10026,48 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns 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) +// 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 } -// 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") +// 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(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") + 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": *getInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerActionOptions.ID, + "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/{instance_group_manager_id}/actions/{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 getInstanceGroupManagerActionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -10073,73 +10078,68 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(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_group_manager_action", 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, 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) +// 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 { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { 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 { @@ -10150,12 +10150,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 @@ -10166,54 +10166,60 @@ 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) +// 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 } -// 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") +// 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(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + 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": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, } - 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}/memberships/{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 getInstanceGroupMembershipOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -10223,12 +10229,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, "create_instance_group_manager", 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, UnmarshalInstanceGroupManager) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10239,59 +10245,52 @@ 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) +// 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 } -// 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") +// 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(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + 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": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.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}/actions`, 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 listInstanceGroupManagerActionsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { 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 { @@ -10299,78 +10298,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_manager", 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 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) +// 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 } -// 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") +// 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(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + 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": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + "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/{instance_group_manager_id}/policies`, 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 listInstanceGroupManagerPoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { 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 { @@ -10381,12 +10365,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_manager", 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, UnmarshalInstanceGroupManager) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10397,57 +10381,59 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + 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": *listInstanceGroupManagersOptions.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}/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 listInstanceGroupManagersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10459,12 +10445,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, "update_instance_group_manager", 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, UnmarshalInstanceGroupManager) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10475,57 +10461,58 @@ 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) +// 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 } -// 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") +// 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(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + 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": *listInstanceGroupMembershipsOptions.InstanceGroupID, + "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}/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 listInstanceGroupMembershipsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { 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 listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) } request, err := builder.Build() @@ -10537,12 +10524,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, "list_instance_group_manager_actions", 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, UnmarshalInstanceGroupManagerActionsCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10553,48 +10540,59 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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`, nil) + _, 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 listInstanceGroupsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10606,12 +10604,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, "create_instance_group_manager_action", 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, UnmarshalInstanceGroupManagerAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10622,141 +10620,119 @@ 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) +// 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 } -// 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") +// 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(updateInstanceGroupOptions, "updateInstanceGroupOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.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/{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 updateInstanceGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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_manager_action", 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) +// 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 } -// 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") +// 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(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + 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": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, + "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerActionOptions.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/{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 updateInstanceGroupManagerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -10766,12 +10742,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, "get_instance_group_manager_action", 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, UnmarshalInstanceGroupManagerAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10818,12 +10794,12 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex return } - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -10863,60 +10839,58 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + 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": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, } - 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}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -10928,12 +10902,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_group_manager_policies", 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, UnmarshalInstanceGroupManagerPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10944,56 +10918,56 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") + 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": *updateInstanceGroupMembershipOptions.InstanceGroupID, - "id": *updateInstanceGroupMembershipOptions.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/{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 updateInstanceGroupMembershipOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { 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(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -11008,12 +10982,12 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group_membership", 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, UnmarshalInstanceGroupMembership) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11024,46 +10998,48 @@ 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) +// 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 } -// 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") +// 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(activateReservationOptions, "activateReservationOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *activateReservationOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.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, `/reservations/{id}/activate`, 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 activateReservationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -11078,7 +11054,7 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "activate_reservation", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -11086,79 +11062,55 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe 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) +// 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 } -// 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") +// 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(createReservationOptions, "createReservationOptions") + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/reservations`, nil) + _, 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 createReservationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -11168,12 +11120,12 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_reservation", 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, UnmarshalReservation) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11184,54 +11136,62 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv 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) +// 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 } -// 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") +// 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(deleteReservationOptions, "deleteReservationOptions") + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteReservationOptions.ID, + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.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, `/reservations/{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 deleteReservationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -11241,12 +11201,12 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_reservation", 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, UnmarshalReservation) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11257,49 +11217,49 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv 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) +// 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 } -// 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") +// 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(getReservationOptions, "getReservationOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getReservationOptions.ID, + "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, `/reservations/{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 getReservationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -11310,86 +11270,67 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO 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_reservation", 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, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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, `/reservations`, nil) + _, 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 listReservationsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { 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.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)) + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) } - if listReservationsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) } request, err := builder.Build() @@ -11401,12 +11342,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, "list_instance_group_memberships", 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, UnmarshalInstanceGroupMembershipCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11417,136 +11358,118 @@ 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) +// 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 } -// 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") +// 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(updateReservationOptions, "updateReservationOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateReservationOptions.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, `/reservations/{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 updateReservationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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) + 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 } - request, err := builder.Build() - if 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, "delete_instance_group_membership", 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) +// 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 } -// 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") +// 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(createDedicatedHostOptions, "createDedicatedHostOptions") + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/dedicated_hosts`, nil) + _, 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 createDedicatedHostOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -11556,12 +11479,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, "get_instance_group_membership", 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, UnmarshalInstanceGroupMembership) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11572,67 +11495,56 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi 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) +// 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 } -// 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") +// 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(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") + err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/dedicated_host/groups`, nil) + _, 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 createDedicatedHostGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { 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 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) + _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -11647,12 +11559,12 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_dedicated_host_group", getServiceComponentInfo()) + 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, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11663,49 +11575,40 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat return } -// DeleteDedicatedHost : Delete 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) +// 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 } -// 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") +// 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{ - "id": *deleteDedicatedHostOptions.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, `/dedicated_hosts/{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 deleteDedicatedHostOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -11716,121 +11619,146 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi 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_dedicated_host", 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, UnmarshalInstanceTemplateCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + 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) { - response, err = vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) +// 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 } -// 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") +// 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(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") 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 := core.NewRequestBuilder(core.POST) 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, `/instance/templates`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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_dedicated_host_group", 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, UnmarshalInstanceTemplate) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getDedicatedHostOptions, "getDedicatedHostOptions") + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.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, `/dedicated_hosts/{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 getDedicatedHostOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -11841,66 +11769,56 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH 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_dedicated_host", 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, 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) +// 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 } -// 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") +// 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(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") 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": *getInstanceTemplateOptions.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, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -11917,12 +11835,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, "get_instance_template", 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, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11933,53 +11851,62 @@ 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) +// 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 } -// 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") +// 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(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, + "id": *updateInstanceTemplateOptions.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_host/groups/{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 getDedicatedHostGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -11989,12 +11916,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, "update_instance_template", 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, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12005,46 +11932,38 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic 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) +// 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 } -// 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") +// 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{ - "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) + _, 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 getDedicatedHostProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -12061,12 +11980,12 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host_profile", 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, UnmarshalDedicatedHostProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12077,48 +11996,46 @@ 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) +// 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 } -// 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") +// 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(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + "name": *getInstanceProfileOptions.Name, } 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, `/instance/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -12135,12 +12052,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, "get_instance_profile", 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, UnmarshalInstanceProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12151,18 +12068,17 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed return } -// ListDedicatedHostGroups : List dedicated host groups -// 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) +// 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 } -// 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") +// 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 @@ -12171,38 +12087,83 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder := core.NewRequestBuilder(core.GET) 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, `/instances`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstancesOptions.Headers { 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 listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.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)) + } + 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.ReservationAffinityPolicy != nil { + builder.AddQuery("reservation_affinity.policy", fmt.Sprint(*listInstancesOptions.ReservationAffinityPolicy)) + } + 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() @@ -12214,12 +12175,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, "list_instances", 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, UnmarshalInstanceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12230,49 +12191,59 @@ 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) +// 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. +// +// For this request to succeed, the properties in the request must adhere to the source's +// `allowed_use` property. +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 } -// 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") +// 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.GET) + builder := core.NewRequestBuilder(core.POST) 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, `/instances`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -12284,12 +12255,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, "create_instance", 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, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12300,61 +12271,58 @@ 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/dedicated_hosts`, nil) + _, 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 listDedicatedHostsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + 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)) - 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 { @@ -12362,81 +12330,63 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat 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_dedicated_hosts", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance", 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) +// 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 } -// 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") +// 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(updateDedicatedHostOptions, "updateDedicatedHostOptions") + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, + "id": *getInstanceOptions.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_hosts/{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 updateDedicatedHostOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -12446,12 +12396,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, "get_instance", 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, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12462,56 +12412,62 @@ 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) +// 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. +// +// For this request to succeed, the properties in the request must adhere to the +// `allowed_use` property in the volume referenced by `boot_volume_attachment.volume`. +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 } -// 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") +// 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(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") 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": *updateInstanceOptions.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, `/instances/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceOptions.Headers { 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(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -12526,12 +12482,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_instance", 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, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12542,62 +12498,54 @@ 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) +// 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 } -// 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") +// 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(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, + "id": *getInstanceInitializationOptions.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, `/instances/{id}/initialization`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -12607,12 +12555,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_instance_initialization", 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, UnmarshalInstanceInitialization) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12623,42 +12571,47 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat 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) +// 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 } -// 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") +// 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(createPlacementGroupOptions, "createPlacementGroupOptions") + 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, `/placement_groups`, 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 createPlacementGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceActionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -12668,14 +12621,11 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla 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 createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type } - if createPlacementGroupOptions.ResourceGroup != nil { - body["resource_group"] = createPlacementGroupOptions.ResourceGroup + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -12692,12 +12642,12 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_placement_group", 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, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12708,52 +12658,59 @@ 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) { - response, err = vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +// 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 } -// 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") +// 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(deletePlacementGroupOptions, "deletePlacementGroupOptions") + err = core.ValidateStruct(listInstanceClusterNetworkAttachmentsOptions, "listInstanceClusterNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deletePlacementGroupOptions.ID, + "instance_id": *listInstanceClusterNetworkAttachmentsOptions.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, `/placement_groups/{id}`, pathParamsMap) + _, 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 deletePlacementGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceClusterNetworkAttachments") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceClusterNetworkAttachmentsOptions.Headers { 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 { @@ -12761,63 +12718,93 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla 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_placement_group", getServiceComponentInfo()) + 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 } -// 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) +// 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 } -// 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") +// 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(getPlacementGroupOptions, "getPlacementGroupOptions") + err = core.ValidateStruct(createClusterNetworkAttachmentOptions, "createClusterNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPlacementGroupOptions.ID, + "instance_id": *createClusterNetworkAttachmentOptions.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, `/placement_groups/{id}`, pathParamsMap) + _, 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 getPlacementGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createClusterNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -12827,12 +12814,12 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_placement_group", getServiceComponentInfo()) + 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, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12843,49 +12830,56 @@ 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/placement_groups`, nil) + _, 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 listPlacementGroupsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceClusterNetworkAttachmentOptions.Headers { 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 { @@ -12896,12 +12890,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, "delete_instance_cluster_network_attachment", 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, UnmarshalInstanceClusterNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12912,61 +12906,54 @@ 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) +// 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 } -// 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") +// 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(updatePlacementGroupOptions, "updatePlacementGroupOptions") + err = core.ValidateStruct(getInstanceClusterNetworkAttachmentOptions, "getInstanceClusterNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, + "instance_id": *getInstanceClusterNetworkAttachmentOptions.InstanceID, + "id": *getInstanceClusterNetworkAttachmentOptions.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, `/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 updatePlacementGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceClusterNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -12976,12 +12963,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_instance_cluster_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, UnmarshalInstanceClusterNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12992,63 +12979,63 @@ 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) +// 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 } -// 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") +// 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(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateInstanceClusterNetworkAttachmentOptions, "updateInstanceClusterNetworkAttachmentOptions") 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, + "instance_id": *updateInstanceClusterNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceClusterNetworkAttachmentOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, 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 addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceClusterNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -13058,12 +13045,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, "update_instance_cluster_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, UnmarshalInstanceClusterNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13074,44 +13061,49 @@ 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) { - result, response, err = vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +// 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 } -// 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") +// 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(createBareMetalServerOptions, "createBareMetalServerOptions") + 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, `/bare_metal_servers`, 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 createBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -13120,7 +13112,14 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) + 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 @@ -13135,12 +13134,12 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_bare_metal_server", 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, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13151,71 +13150,55 @@ 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. 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) +// 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 } -// 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") +// 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(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + "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, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, 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 createBareMetalServerConsoleAccessTokenOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -13225,12 +13208,12 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(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_console_access_token", 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, UnmarshalBareMetalServerConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13241,62 +13224,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) +// 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 } -// 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") +// 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(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.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, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -13306,12 +13281,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, "get_instance_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, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13322,63 +13297,56 @@ 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) +// 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 } -// 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") +// 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(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, 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 createBareMetalServerNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceDiskOptions.Headers { 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -13393,12 +13361,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, "update_instance_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, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13409,49 +13377,54 @@ 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) +// 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 +// 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 } -// 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") +// 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(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.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, `/bare_metal_servers/{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 deleteBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -13462,129 +13435,157 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{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 deleteBareMetalServerNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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_bare_metal_server_network_attachment", 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 } -// 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) +// 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 } -// 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") +// 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(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{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 deleteBareMetalServerNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -13599,7 +13600,7 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -13607,46 +13608,47 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C 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) +// 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 } -// 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") +// 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(getBareMetalServerOptions, "getBareMetalServerOptions") + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, + "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, `/bare_metal_servers/{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 getBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -13663,12 +13665,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, "get_instance_network_attachment", 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, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13679,54 +13681,63 @@ 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) { - result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// 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 } -// 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") +// 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(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_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 getBareMetalServerDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -13736,12 +13747,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, "update_instance_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, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13752,48 +13763,53 @@ 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) +// 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 } -// 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") +// 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(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.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, `/bare_metal_servers/{id}/initialization`, 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 getBareMetalServerInitializationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -13810,12 +13826,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, "list_instance_network_interfaces", 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, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13826,54 +13842,83 @@ 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) +// 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 } -// 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") +// 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(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_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 getBareMetalServerNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -13883,12 +13928,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, "create_instance_network_interface", 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, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13899,54 +13944,56 @@ 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. +// 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 bare metal server has network attachments, the retrieved network interface is a [read-only +// 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. -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 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 } -// 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") +// 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(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{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 getBareMetalServerNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -13957,68 +14004,61 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(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, "get_bare_metal_server_network_interface", 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, 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) +// 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 } -// 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") +// 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(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{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 getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -14035,12 +14075,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, "get_instance_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, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14051,58 +14091,67 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co 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) +// 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 } -// 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") +// 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(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{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 getBareMetalServerNetworkInterfaceIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -14112,12 +14161,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, "update_instance_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, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14128,46 +14177,47 @@ 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) +// 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 } -// 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") +// 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(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "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, `/bare_metal_server/profiles/{name}`, 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 getBareMetalServerProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -14184,12 +14234,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, "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, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14200,50 +14250,50 @@ 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) +// 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 } -// 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") +// 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(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "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, `/bare_metal_servers/{bare_metal_server_id}/disks`, 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 listBareMetalServerDisksOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -14254,84 +14304,65 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB 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_disks", 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, UnmarshalBareMetalServerDiskCollection) - 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. -// -// 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) +// 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 } -// 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") +// 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(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "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, `/bare_metal_servers/{bare_metal_server_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 listBareMetalServerNetworkAttachmentsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { 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 { @@ -14342,12 +14373,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_instance_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 @@ -14358,47 +14389,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) +// 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 } -// 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") +// 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(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, 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 listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -14415,12 +14454,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_instance_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 @@ -14431,56 +14470,62 @@ 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. +// 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) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +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 } -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +// 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) 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") +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(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, 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 listBareMetalServerNetworkInterfaceIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { 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 { @@ -14491,12 +14536,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. 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()) + 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, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14507,65 +14552,57 @@ 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) +// 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 } -// 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") +// 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(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, 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 listBareMetalServerNetworkInterfacesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { 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 { @@ -14576,12 +14613,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_instance_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 @@ -14592,51 +14629,54 @@ 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) +// 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 } -// 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") +// 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, `/bare_metal_server/profiles`, 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 listBareMetalServerProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { 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 { @@ -14647,12 +14687,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_instance_volume_attachments", 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, UnmarshalVolumeAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14663,72 +14703,71 @@ 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) +// 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 } -// 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") +// 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, `/bare_metal_servers`, 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 listBareMetalServersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 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.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)) + + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -14740,12 +14779,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, "create_instance_volume_attachment", 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, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14756,48 +14795,48 @@ 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) +// 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 } -// 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") +// 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(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{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 removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -14812,7 +14851,7 @@ 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, "delete_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -14820,71 +14859,54 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx return } -// 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) +// 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 } -// 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") +// 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(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions") + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceBareMetalServerInitializationOptions.ID, + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.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/{id}/initialization`, 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 replaceBareMetalServerInitializationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceBareMetalServerInitialization") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -14894,12 +14916,12 @@ func (vpc *VpcV1) ReplaceBareMetalServerInitializationWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_bare_metal_server_initialization", 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, UnmarshalBareMetalServerInitialization) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14910,114 +14932,135 @@ func (vpc *VpcV1) ReplaceBareMetalServerInitializationWithContext(ctx context.Co return } -// RestartBareMetalServer : Restart a bare metal 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) +// 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 } -// 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") +// 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(restartBareMetalServerOptions, "restartBareMetalServerOptions") + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *restartBareMetalServerOptions.ID, + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range restartBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "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 } - 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, "restart_bare_metal_server", 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, UnmarshalVolumeAttachment) + 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) { - response, err = vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) +// 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 } -// 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") +// 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{ - "id": *startBareMetalServerOptions.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}/start`, 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 startBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listKeysOptions.Headers { 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)) + } + if listKeysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -15025,67 +15068,83 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare 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, "start_bare_metal_server", 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, UnmarshalKeyCollection) + 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) { - response, err = vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +// 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 } -// 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") +// 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(stopBareMetalServerOptions, "stopBareMetalServerOptions") + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") 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, `/keys`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range stopBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 stopBareMetalServerOptions.Type != nil { - body["type"] = stopBareMetalServerOptions.Type + 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 { @@ -15099,71 +15158,134 @@ 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 { - core.EnrichHTTPProblem(err, "stop_bare_metal_server", getServiceComponentInfo()) + 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 } -// 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) +// 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 } -// 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") +// 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(updateBareMetalServerOptions, "updateBareMetalServerOptions") + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, + "id": *deleteKeyOptions.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, `/keys/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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) + 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_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 } + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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()) @@ -15173,12 +15295,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, "get_key", 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, UnmarshalKey) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15189,47 +15311,46 @@ 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) +// 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 } -// 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") +// 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(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") 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": *updateKeyOptions.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) + _, 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 updateBareMetalServerDiskOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateKeyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -15238,7 +15359,7 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -15253,12 +15374,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, "update_key", 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, UnmarshalKey) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15269,61 +15390,49 @@ 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) +// 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 } -// 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") +// 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{ - "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, `/load_balancer/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -15335,12 +15444,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, "list_load_balancer_profiles", 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, UnmarshalLoadBalancerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15351,67 +15460,53 @@ 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) { - result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +// 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 } -// 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") +// 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(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") 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, + "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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{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 updateBareMetalServerNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -15421,12 +15516,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_load_balancer_profile", 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, UnmarshalLoadBalancerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15437,61 +15532,48 @@ 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) +// 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 } -// 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") +// 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{ - "id": *updateFirmwareForBareMetalServerOptions.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}/firmware/update`, 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 updateFirmwareForBareMetalServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancersOptions.Headers { 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 updateFirmwareForBareMetalServerOptions.AutoStart != nil { - body["auto_start"] = updateFirmwareForBareMetalServerOptions.AutoStart + if listLoadBalancersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listLoadBalancersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) } request, err := builder.Build() @@ -15500,33 +15582,41 @@ func (vpc *VpcV1) UpdateFirmwareForBareMetalServerWithContext(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, "update_firmware_for_bare_metal_server", 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 } -// 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) +// 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 } -// 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") +// 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(createVolumeOptions, "createVolumeOptions") + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -15535,18 +15625,18 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, 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 createVolumeOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -15555,7 +15645,44 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + 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 @@ -15570,12 +15697,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, "create_load_balancer", 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, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15586,51 +15713,51 @@ 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) +// 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 } -// 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") +// 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(deleteVolumeOptions, "deleteVolumeOptions") + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, + "id": *deleteLoadBalancerOptions.ID, } 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, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVolumeOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + if deleteLoadBalancerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -15644,7 +15771,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, "delete_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -15652,46 +15779,46 @@ 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) +// 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 } -// 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") +// 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(getVolumeOptions, "getVolumeOptions") + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVolumeOptions.ID, + "id": *getLoadBalancerOptions.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, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -15708,12 +15835,12 @@ 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, "get_load_balancer", 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, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15724,53 +15851,65 @@ 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) +// 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 } -// 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") +// 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(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "id": *updateLoadBalancerOptions.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, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { 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()) @@ -15780,12 +15919,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_load_balancer", 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, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15796,50 +15935,52 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf 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) +// 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 } -// 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") +// 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, `/volume/profiles`, nil) + _, 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 listVolumeProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { 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 { @@ -15850,12 +15991,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, "get_load_balancer_statistics", 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, UnmarshalLoadBalancerStatistics) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15866,71 +16007,52 @@ 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) +// 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 } -// 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") +// 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, `/volumes`, nil) + _, 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 listVolumesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { 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.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - 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.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) - } request, err := builder.Build() if err != nil { @@ -15941,12 +16063,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_load_balancer_listeners", 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, UnmarshalLoadBalancerListenerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15957,59 +16079,89 @@ 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) +// 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 } -// 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") +// 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(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.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, `/volumes/{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 updateVolumeOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { 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) + 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 @@ -16024,12 +16176,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_load_balancer_listener", 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, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16040,124 +16192,111 @@ 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) +// 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 } -// 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") +// 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(createSnapshotOptions, "createSnapshotOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/snapshots`, nil) + _, 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 createSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_listener", 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) +// 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 } -// 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") +// 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(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.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, `/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 createSnapshotCloneOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -16174,12 +16313,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_load_balancer_listener", 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, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16190,53 +16329,56 @@ 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) +// 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 } -// 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") +// 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(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/snapshot_consistency_groups`, nil) + _, 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 createSnapshotConsistencyGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -16251,12 +16393,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, "update_load_balancer_listener", 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, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16267,51 +16409,51 @@ 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) +// 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 } -// 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") +// 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(deleteSnapshotOptions, "deleteSnapshotOptions") + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.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, `/snapshots/{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 deleteSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -16322,128 +16464,98 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO 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", 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, UnmarshalLoadBalancerListenerPolicyCollection) + 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) +// 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 load balancer must be in the `application` family. +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 } -// 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") +// 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(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, } - 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}/clones/{zone_name}`, 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 deleteSnapshotCloneOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action } - - 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 createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority } - - 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 + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.ID, + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target } - - 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.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 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()) @@ -16453,12 +16565,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_load_balancer_listener_policy", 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16469,48 +16581,53 @@ 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) +// 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 } -// 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") +// 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(deleteSnapshotsOptions, "deleteSnapshotsOptions") + 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, `/snapshots`, nil) + _, 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 deleteSnapshotsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { 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 { @@ -16520,7 +16637,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_load_balancer_listener_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -16528,46 +16645,48 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot 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) +// 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 } -// 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") +// 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(getSnapshotOptions, "getSnapshotOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.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, `/snapshots/{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 getSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -16584,12 +16703,12 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_snapshot", 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, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16600,54 +16719,63 @@ 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) +// 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 } -// 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") +// 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(getSnapshotCloneOptions, "getSnapshotCloneOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, + "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, `/snapshots/{id}/clones/{zone_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 getSnapshotCloneOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -16657,12 +16785,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_load_balancer_listener_policy", 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16673,46 +16801,48 @@ 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) +// 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 } -// 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") +// 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(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{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 getSnapshotConsistencyGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -16729,12 +16859,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_load_balancer_listener_policy_rules", 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, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16745,53 +16875,75 @@ 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) +// 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 } -// 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") +// 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(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, + "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, `/snapshots/{id}/clones`, 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 listSnapshotClonesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -16801,12 +16953,12 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_snapshot_clones", 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, UnmarshalSnapshotCloneCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16817,62 +16969,54 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/snapshot_consistency_groups`, nil) + _, 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 listSnapshotConsistencyGroupsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { 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 { @@ -16880,129 +17024,65 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(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_snapshot_consistency_groups", 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, UnmarshalSnapshotConsistencyGroupCollection) - 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) +// 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 } -// 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") +// 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, `/snapshots`, nil) + _, 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 listSnapshotsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { 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 { @@ -17013,12 +17093,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, "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, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17029,59 +17109,58 @@ 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) +// 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 } -// 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") +// 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(updateSnapshotOptions, "updateSnapshotOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.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, `/snapshots/{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 updateSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -17096,12 +17175,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, "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, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17112,65 +17191,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) +// 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 } -// 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") +// 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(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.ID, + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, } - 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { 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()) @@ -17180,12 +17247,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, "list_load_balancer_pools", 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, UnmarshalLoadBalancerPoolCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17196,46 +17263,46 @@ 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) +// 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 } -// 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") +// 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(createShareOptions, "createShareOptions") + 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, `/shares`, 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 createShareOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -17244,7 +17311,32 @@ 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) + 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.FailsafePolicy != nil { + body["failsafe_policy"] = createLoadBalancerPoolOptions.FailsafePolicy + } + 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 @@ -17259,12 +17351,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, "create_load_balancer_pool", 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, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17275,161 +17367,118 @@ 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) { - result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// 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, nor be the target pool in the failsafe policy for any other pool. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) 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") +// 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(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, + "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, `/shares/{share_id}/mount_targets`, 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 createShareMountTargetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_share_mount_target", 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, UnmarshalShareMountTarget) - 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 an `access_control_mode` of `security_group`, and a -// `replication_role` of `source` or `none`. -// -// The snapshot will inherit its `resource_group` and encryption settings from the share. -// -// 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) +// 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 } -// 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") +// 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(createShareSnapshotOptions, "createShareSnapshotOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *createShareSnapshotOptions.ShareID, + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.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}/snapshots`, 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 createShareSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -17439,12 +17488,12 @@ func (vpc *VpcV1) CreateShareSnapshotWithContext(ctx context.Context, createShar var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_share_snapshot", 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, UnmarshalShareSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17455,62 +17504,61 @@ func (vpc *VpcV1) CreateShareSnapshotWithContext(ctx context.Context, createShar 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) +// 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 } -// 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") +// 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(deleteShareOptions, "deleteShareOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteShareOptions.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, `/shares/{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 deleteShareOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { 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("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()) @@ -17520,12 +17568,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_load_balancer_pool", 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, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17536,52 +17584,59 @@ 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) +// 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 } -// 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") +// 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(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions") + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareAccessorBindingOptions.ShareID, - "id": *deleteShareAccessorBindingOptions.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, `/shares/{share_id}/accessor_bindings/{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 deleteShareAccessorBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listLoadBalancerPoolMembersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerPoolMembersOptions.Start)) + } + if listLoadBalancerPoolMembersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerPoolMembersOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -17589,67 +17644,92 @@ 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, "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 } -// DeleteShareMountTarget : Delete a file share mount target -// This request deletes a share mount target. This operation cannot be reversed. +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. // -// 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) +// The pool must not already have a member targeting a load balancer. +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 } -// 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") +// 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(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - 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, `/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 deleteShareMountTargetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -17659,12 +17739,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, "create_load_balancer_pool_member", 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, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17675,65 +17755,66 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS 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) +// 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 } -// 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") +// 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(deleteShareSnapshotOptions, "deleteShareSnapshotOptions") + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSnapshotOptions.ShareID, - "id": *deleteShareSnapshotOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - 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, `/shares/{share_id}/snapshots/{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 deleteShareSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -17743,12 +17824,12 @@ func (vpc *VpcV1) DeleteShareSnapshotWithContext(ctx context.Context, deleteShar var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_share_snapshot", 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, UnmarshalShareSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17759,50 +17840,48 @@ func (vpc *VpcV1) DeleteShareSnapshotWithContext(ctx context.Context, deleteShar 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) +// 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 } -// 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") +// 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(deleteShareSourceOptions, "deleteShareSourceOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, + "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, `/shares/{share_id}/source`, 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 deleteShareSourceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -17817,7 +17896,7 @@ 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_load_balancer_pool_member", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -17825,134 +17904,136 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS 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) +// 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 } -// 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") +// 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(failoverShareOptions, "failoverShareOptions") + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.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}/failover`, 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 failoverShareOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { 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 - } - _, 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, "failover_share", 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, UnmarshalLoadBalancerPoolMember) + 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) { - result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) +// 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 } -// 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") +// 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(getShareOptions, "getShareOptions") + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.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/{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 getShareOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -17962,12 +18043,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, "update_load_balancer_pool_member", 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, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17978,53 +18059,55 @@ 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) +// ListNetworkAcls : List network ACLs +// This request lists network ACLs in the region. A network ACL defines a set of packet filtering rules for traffic in +// and out of the subnets the network ACL is attached to. No traffic is allowed by default. Both allow and deny rules +// can be defined, and rules are stateless so that reverse traffic in response to allowed traffic is not automatically +// allowed. +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 } -// 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") +// 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{ - "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) + _, 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 getShareAccessorBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listNetworkAclsOptions.Headers { 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 { @@ -18035,12 +18118,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, "list_network_acls", 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, UnmarshalNetworkACLCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18051,54 +18134,58 @@ 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) +// 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 } -// 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") +// 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(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") 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 := 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, `/network_acls`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -18108,12 +18195,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, "create_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18124,49 +18211,49 @@ 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) +// 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 } -// 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") +// 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(getShareProfileOptions, "getShareProfileOptions") + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, + "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, `/share/profiles/{name}`, 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 getShareProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -18177,66 +18264,56 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil 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_share_profile", 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, UnmarshalShareProfile) - 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) +// 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 } -// 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") +// 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(getShareSnapshotOptions, "getShareSnapshotOptions") + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSnapshotOptions.ShareID, - "id": *getShareSnapshotOptions.ID, + "id": *getNetworkACLOptions.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) + _, 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 getShareSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -18253,12 +18330,12 @@ func (vpc *VpcV1) GetShareSnapshotWithContext(ctx context.Context, getShareSnaps var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_snapshot", 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, UnmarshalShareSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18269,54 +18346,60 @@ func (vpc *VpcV1) GetShareSnapshotWithContext(ctx context.Context, getShareSnaps 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) +// 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 } -// 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") +// 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(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "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, `/shares/{share_id}/source`, 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 getShareSourceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -18326,12 +18409,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_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18342,60 +18425,61 @@ 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 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) { - result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) +// 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 } -// 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") +// 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(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listShareAccessorBindingsOptions.ID, + "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, `/shares/{id}/accessor_bindings`, 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 listShareAccessorBindingsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { 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 listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) } - if listShareAccessorBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.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() @@ -18407,12 +18491,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, "list_network_acl_rules", 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, UnmarshalNetworkACLRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18423,63 +18507,59 @@ func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, list 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) +// 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 } -// 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") +// 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(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, } - 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -18491,12 +18571,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, "create_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18507,53 +18587,52 @@ 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/share/profiles`, nil) + _, 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 listShareProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { 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 { @@ -18561,89 +18640,63 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro 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_profiles", 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, UnmarshalShareProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listShareSnapshotsOptions, "listShareSnapshotsOptions") + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *listShareSnapshotsOptions.ShareID, + "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, `/shares/{share_id}/snapshots`, 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 listShareSnapshotsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareSnapshots") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { 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 { @@ -18654,12 +18707,12 @@ func (vpc *VpcV1) ListShareSnapshotsWithContext(ctx context.Context, listShareSn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_snapshots", 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, UnmarshalShareSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18670,60 +18723,61 @@ func (vpc *VpcV1) ListShareSnapshotsWithContext(ctx context.Context, listShareSn 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/shares`, nil) + _, 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 listSharesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 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(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -18735,12 +18789,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, "update_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18751,62 +18805,48 @@ 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) +// 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 } -// 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") +// 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{ - "id": *updateShareOptions.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, `/placement_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPlacementGroupsOptions.Headers { 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 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() @@ -18818,12 +18858,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_placement_groups", 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, UnmarshalPlacementGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18834,58 +18874,61 @@ 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) +// 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 } -// 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") +// 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(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") 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 := 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, `/placement_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createPlacementGroupOptions.Headers { 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(updateShareMountTargetOptions.ShareMountTargetPatch) + 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 @@ -18900,12 +18943,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, "create_placement_group", 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, UnmarshalPlacementGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18916,142 +18959,116 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS 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) +// 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 } -// 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") +// 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(updateShareSnapshotOptions, "updateShareSnapshotOptions") + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *updateShareSnapshotOptions.ShareID, - "id": *updateShareSnapshotOptions.ID, + "id": *deletePlacementGroupOptions.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}/snapshots/{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 updateShareSnapshotOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareSnapshot") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deletePlacementGroupOptions.Headers { 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_share_snapshot", getServiceComponentInfo()) + 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, UnmarshalShareSnapshot) - 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) +// 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 } -// 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") +// 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(createBackupPolicyOptions, "createBackupPolicyOptions") + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/backup_policies`, nil) + _, 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 createBackupPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -19061,12 +19078,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, "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 @@ -19077,87 +19094,56 @@ 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) { - result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +// 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 } -// 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") +// 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(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + "id": *updatePlacementGroupOptions.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, `/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 { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updatePlacementGroupOptions.Headers { 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 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(updatePlacementGroupOptions.PlacementGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -19172,12 +19158,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, "update_placement_group", 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, UnmarshalPlacementGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19188,58 +19174,59 @@ 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. -// -// 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) +// 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 } -// 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") +// 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 } - pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.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, `/private_path_service_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { 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 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 { @@ -19250,12 +19237,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_private_path_service_gateways", 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, UnmarshalPrivatePathServiceGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19266,62 +19253,77 @@ 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) +// 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 } -// 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") +// 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(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions") 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.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, `/private_path_service_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.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 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()) @@ -19331,12 +19333,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, "create_private_path_service_gateway", 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, UnmarshalPrivatePathServiceGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19347,49 +19349,49 @@ 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) +// 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 } -// 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") +// 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(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "id": *deletePrivatePathServiceGatewayOptions.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/{id}`, pathParamsMap) + _, 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 getBackupPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -19400,66 +19402,56 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic 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_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_private_path_service_gateway", 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) +// 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 } -// 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") +// 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(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions") 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": *getPrivatePathServiceGatewayOptions.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, `/private_path_service_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -19476,12 +19468,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, "get_private_path_service_gateway", 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, UnmarshalPrivatePathServiceGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19492,54 +19484,62 @@ 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) +// 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 } -// 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") +// 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(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + err = core.ValidateStruct(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions") 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": *updatePrivatePathServiceGatewayOptions.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/{id}`, pathParamsMap) + _, 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 getBackupPolicyPlanOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -19549,12 +19549,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, "update_private_path_service_gateway", 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, UnmarshalPrivatePathServiceGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19565,58 +19565,65 @@ 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) +// 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 } -// 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") +// 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, `/backup_policies`, nil) + _, 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 listBackupPoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { 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 listPrivatePathServiceGatewayAccountPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Start)) } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + if listPrivatePathServiceGatewayAccountPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Limit)) } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + if listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID)) } request, err := builder.Build() @@ -19628,12 +19635,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_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, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19644,76 +19651,66 @@ 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) +// 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 } -// 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") +// 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(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + err = core.ValidateStruct(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + "private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, } - 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, `/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 listBackupPolicyJobsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 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)) + + body := make(map[string]interface{}) + if createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy != nil { + body["access_policy"] = createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + if createPrivatePathServiceGatewayAccountPolicyOptions.Account != nil { + body["account"] = createPrivatePathServiceGatewayAccountPolicyOptions.Account } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -19725,12 +19722,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, "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, UnmarshalBackupPolicyJobCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19741,55 +19738,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) +// 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 } -// 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") +// 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(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + "private_path_service_gateway_id": *deletePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *deletePrivatePathServiceGatewayAccountPolicyOptions.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`, pathParamsMap) + _, 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 listBackupPolicyPlansOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deletePrivatePathServiceGatewayAccountPolicyOptions.Headers { 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 { @@ -19797,83 +19792,64 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack 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_plans", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_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, 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) +// 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 } -// 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") +// 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(updateBackupPolicyOptions, "updateBackupPolicyOptions") + err = core.ValidateStruct(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, + "private_path_service_gateway_id": *getPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *getPrivatePathServiceGatewayAccountPolicyOptions.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/{id}`, pathParamsMap) + _, 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 updateBackupPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers { 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()) @@ -19883,12 +19859,12 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_backup_policy", getServiceComponentInfo()) + 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, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19899,60 +19875,58 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku 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) +// 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 } -// 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") +// 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(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + err = core.ValidateStruct(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions") 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, + "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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, 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 updateBackupPolicyPlanOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { 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) + _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayAccountPolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -19967,12 +19941,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_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, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19983,52 +19957,71 @@ 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) +// 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 } -// 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") +// 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(getRegionOptions, "getRegionOptions") + err = core.ValidateStruct(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getRegionOptions.Name, + "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, `/regions/{name}`, pathParamsMap) + _, 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 getRegionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { 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 { @@ -20039,12 +20032,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_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, UnmarshalRegion) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20055,47 +20048,47 @@ 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) +// 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 } -// 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") +// 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(getRegionZoneOptions, "getRegionZoneOptions") + err = core.ValidateStruct(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, + "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, `/regions/{region_name}/zones/{name}`, pathParamsMap) + _, 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 getRegionZoneOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -20112,12 +20105,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, "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, UnmarshalZone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20128,205 +20121,198 @@ 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) +// 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 } -// 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") +// 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(listRegionZonesOptions, "listRegionZonesOptions") + err = core.ValidateStruct(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "region_name": *listRegionZonesOptions.RegionName, + "private_path_service_gateway_id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.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, `/regions/{region_name}/zones`, pathParamsMap) + _, 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 listRegionZonesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 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 } - 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_region_zones", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "deny_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, UnmarshalZoneCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/regions`, nil) + _, 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 listRegionsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 + } + _, 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, "list_regions", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "permit_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, 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) +// 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 } -// 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") +// 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(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions") 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, + "private_path_service_gateway_id": *publishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, } - 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}/floating_ips/{id}`, pathParamsMap) + _, 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 addNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -20337,257 +20323,205 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(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, "add_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", 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) +// 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 } -// 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") +// 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(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions") 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, + "private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, } - 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, `/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 addVirtualNetworkInterfaceIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 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 } - 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, "add_virtual_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", 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) +// 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 } -// 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") +// 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(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + 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, `/virtual_network_interfaces`, nil) + _, 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 createVirtualNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range unpublishPrivatePathServiceGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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()) 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_virtual_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "unpublish_private_path_service_gateway", 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) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +// ListPublicAddressRanges : List public address ranges +// This request lists [public address ranges](https://cloud.ibm.com/docs/vpc?topic=vpc-about-par) in the region. A +// public address range is a contiguous block of public IP addresses that can be bound to a `target` that specifies a +// `vpc` and a `zone`. Incoming traffic for these IP addresses will be routed according to the VPC's ingress routing +// table. +func (vpc *VpcV1) ListPublicAddressRanges(listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPublicAddressRangesWithContext(context.Background(), listPublicAddressRangesOptions) 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") +// ListPublicAddressRangesWithContext is an alternate form of the ListPublicAddressRanges method which supports a Context parameter +func (vpc *VpcV1) ListPublicAddressRangesWithContext(ctx context.Context, listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPublicAddressRangesOptions, "listPublicAddressRangesOptions") 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 := 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_address_ranges`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicAddressRanges") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPublicAddressRangesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listPublicAddressRangesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicAddressRangesOptions.Start)) + } + if listPublicAddressRangesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicAddressRangesOptions.Limit)) + } + if listPublicAddressRangesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicAddressRangesOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -20598,12 +20532,12 @@ 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, "list_public_address_ranges", 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, UnmarshalPublicAddressRangeCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20614,55 +20548,71 @@ 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) +// CreatePublicAddressRange : Create a public address range +// This request creates a new public address range from a public address range prototype object. The prototype object is +// structured in the same way as a retrieved public address range, and contains the information necessary to create the +// new public address range. +func (vpc *VpcV1) CreatePublicAddressRange(createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreatePublicAddressRangeWithContext(context.Background(), createPublicAddressRangeOptions) 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") +// CreatePublicAddressRangeWithContext is an alternate form of the CreatePublicAddressRange method which supports a Context parameter +func (vpc *VpcV1) CreatePublicAddressRangeWithContext(ctx context.Context, createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPublicAddressRangeOptions, "createPublicAddressRangeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(createPublicAddressRangeOptions, "createPublicAddressRangeOptions") 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 := 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}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicAddressRange") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createPublicAddressRangeOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 createPublicAddressRangeOptions.Ipv4AddressCount != nil { + body["ipv4_address_count"] = createPublicAddressRangeOptions.Ipv4AddressCount + } + if createPublicAddressRangeOptions.Name != nil { + body["name"] = createPublicAddressRangeOptions.Name + } + if createPublicAddressRangeOptions.ResourceGroup != nil { + body["resource_group"] = createPublicAddressRangeOptions.ResourceGroup + } + if createPublicAddressRangeOptions.Target != nil { + body["target"] = createPublicAddressRangeOptions.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()) @@ -20672,12 +20622,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, "create_public_address_range", 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, UnmarshalPublicAddressRange) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20688,46 +20638,47 @@ 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) +// DeletePublicAddressRange : Delete a public address range +// This request deletes a public address range. If the public address range is bound to a +// `target`, it will be unbound. This operation cannot be reversed. +func (vpc *VpcV1) DeletePublicAddressRange(deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeletePublicAddressRangeWithContext(context.Background(), deletePublicAddressRangeOptions) 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") +// DeletePublicAddressRangeWithContext is an alternate form of the DeletePublicAddressRange method which supports a Context parameter +func (vpc *VpcV1) DeletePublicAddressRangeWithContext(ctx context.Context, deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVirtualNetworkInterfaceOptions.ID, + "id": *deletePublicAddressRangeOptions.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, `/public_address_ranges/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicAddressRange") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deletePublicAddressRangeOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -20744,12 +20695,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, "delete_public_address_range", 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, UnmarshalPublicAddressRange) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20760,48 +20711,46 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get 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) +// GetPublicAddressRange : Retrieve a public address range +// This request retrieves a single public address range specified by the identifier in the URL. +func (vpc *VpcV1) GetPublicAddressRange(getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPublicAddressRangeWithContext(context.Background(), getPublicAddressRangeOptions) 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") +// GetPublicAddressRangeWithContext is an alternate form of the GetPublicAddressRange method which supports a Context parameter +func (vpc *VpcV1) GetPublicAddressRangeWithContext(ctx context.Context, getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPublicAddressRangeOptions, "getPublicAddressRangeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(getPublicAddressRangeOptions, "getPublicAddressRangeOptions") 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": *getPublicAddressRangeOptions.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, `/public_address_ranges/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicAddressRange") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPublicAddressRangeOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -20818,12 +20767,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_public_address_range", 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, UnmarshalPublicAddressRange) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20834,60 +20783,60 @@ 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) +// UpdatePublicAddressRange : Update a public address range +// This request updates a public address range with the information in a provided public address range patch. The public +// address range patch object is structured in the same way as a retrieved public address range and contains only the +// information to be updated. +func (vpc *VpcV1) UpdatePublicAddressRange(updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePublicAddressRangeWithContext(context.Background(), updatePublicAddressRangeOptions) 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") +// UpdatePublicAddressRangeWithContext is an alternate form of the UpdatePublicAddressRange method which supports a Context parameter +func (vpc *VpcV1) UpdatePublicAddressRangeWithContext(ctx context.Context, updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + "id": *updatePublicAddressRangeOptions.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}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicAddressRange") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updatePublicAddressRangeOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 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)) + + _, err = builder.SetBodyContentJSON(updatePublicAddressRangeOptions.PublicAddressRangePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -20899,12 +20848,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, "update_public_address_range", 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, UnmarshalPublicAddressRange) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20915,60 +20864,53 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(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) +// 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 } -// 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") +// 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{ - "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) + _, 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 listVirtualNetworkInterfaceIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { 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 listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) } - if listVirtualNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) } - if listVirtualNetworkInterfaceIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -20980,12 +20922,12 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, 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()) + 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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20996,56 +20938,75 @@ 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. +// 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 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) +// 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 } -// 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") +// 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.GET) + builder := core.NewRequestBuilder(core.POST) 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, `/public_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + + body := make(map[string]interface{}) + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + if createPublicGatewayOptions.Zone != nil { + body["zone"] = createPublicGatewayOptions.Zone } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + 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() @@ -21057,12 +21018,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, "create_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21073,47 +21034,48 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l 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) +// 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 } -// 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") +// 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(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") 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, + "id": *deletePublicGatewayOptions.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) + _, 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 removeNetworkInterfaceFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deletePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -21128,7 +21090,7 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -21136,52 +21098,49 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") 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, + "id": *getPublicGatewayOptions.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}/ips/{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 removeVirtualNetworkInterfaceIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -21192,58 +21151,65 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.ID, + "id": *updatePublicGatewayOptions.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) + _, 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 updateVirtualNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -21252,7 +21218,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21267,12 +21233,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, "update_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21283,75 +21249,67 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } -// 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) +// 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 } -// 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(createClusterNetworkOptions, "createClusterNetworkOptions") +// 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.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks`, nil) + _, 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 createClusterNetworkOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetwork") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listReservationsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listReservationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) } - if createClusterNetworkOptions.VPC != nil { - body["vpc"] = createClusterNetworkOptions.VPC + if listReservationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) } - if createClusterNetworkOptions.Zone != nil { - body["zone"] = createClusterNetworkOptions.Zone + if listReservationsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) } - if createClusterNetworkOptions.Name != nil { - body["name"] = createClusterNetworkOptions.Name + if listReservationsOptions.ProfileResourceType != nil { + builder.AddQuery("profile.resource_type", fmt.Sprint(*listReservationsOptions.ProfileResourceType)) } - if createClusterNetworkOptions.ResourceGroup != nil { - body["resource_group"] = createClusterNetworkOptions.ResourceGroup + if listReservationsOptions.AffinityPolicy != nil { + builder.AddQuery("affinity_policy", fmt.Sprint(*listReservationsOptions.AffinityPolicy)) } - if createClusterNetworkOptions.SubnetPrefixes != nil { - body["subnet_prefixes"] = createClusterNetworkOptions.SubnetPrefixes + if listReservationsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listReservationsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) } request, err := builder.Build() @@ -21363,12 +21321,12 @@ func (vpc *VpcV1) CreateClusterNetworkWithContext(ctx context.Context, createClu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_cluster_network", 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, UnmarshalClusterNetwork) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21379,48 +21337,43 @@ func (vpc *VpcV1) CreateClusterNetworkWithContext(ctx context.Context, createClu return } -// 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) +// 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 } -// 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") +// 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(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions") + err = core.ValidateStruct(createReservationOptions, "createReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces`, 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 createClusterNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -21430,14 +21383,26 @@ func (vpc *VpcV1) CreateClusterNetworkInterfaceWithContext(ctx context.Context, builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createClusterNetworkInterfaceOptions.Name != nil { - body["name"] = createClusterNetworkInterfaceOptions.Name + if createReservationOptions.Capacity != nil { + body["capacity"] = createReservationOptions.Capacity } - if createClusterNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createClusterNetworkInterfaceOptions.PrimaryIP + if createReservationOptions.CommittedUse != nil { + body["committed_use"] = createReservationOptions.CommittedUse } - if createClusterNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createClusterNetworkInterfaceOptions.Subnet + 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 { @@ -21454,12 +21419,12 @@ func (vpc *VpcV1) CreateClusterNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_cluster_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21470,62 +21435,54 @@ func (vpc *VpcV1) CreateClusterNetworkInterfaceWithContext(ctx context.Context, return } -// 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) +// 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 } -// 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") +// 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(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions") + err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *deleteReservationOptions.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, `/cluster_networks/{cluster_network_id}/subnets`, 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 createClusterNetworkSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -21535,12 +21492,12 @@ func (vpc *VpcV1) CreateClusterNetworkSubnetWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_cluster_network_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21551,70 +21508,53 @@ func (vpc *VpcV1) CreateClusterNetworkSubnetWithContext(ctx context.Context, cre return } -// 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) +// 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 } -// 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") +// 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(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions") + err = core.ValidateStruct(getReservationOptions, "getReservationOptions") 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, + "id": *getReservationOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, 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 createClusterNetworkSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 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 - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -21624,12 +21564,12 @@ func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIPWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_cluster_network_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21640,58 +21580,61 @@ func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIPWithContext(ctx context.Co return } -// 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) +// 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 } -// 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") +// 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(deleteClusterNetworkOptions, "deleteClusterNetworkOptions") + err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteClusterNetworkOptions.ID, + "id": *updateReservationOptions.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, `/cluster_networks/{id}`, 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 deleteClusterNetworkOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetwork") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteClusterNetworkOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkOptions.IfMatch)) - } + 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()) @@ -21701,12 +21644,12 @@ func (vpc *VpcV1) DeleteClusterNetworkWithContext(ctx context.Context, deleteClu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_cluster_network", 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, UnmarshalClusterNetwork) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21717,55 +21660,48 @@ func (vpc *VpcV1) DeleteClusterNetworkWithContext(ctx context.Context, deleteClu return } -// 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) +// 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 } -// 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") +// 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(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions") + err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *deleteClusterNetworkInterfaceOptions.ClusterNetworkID, - "id": *deleteClusterNetworkInterfaceOptions.ID, + "id": *activateReservationOptions.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, `/cluster_networks/{cluster_network_id}/interfaces/{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 deleteClusterNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range activateReservationOptions.Headers { 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)) @@ -21776,77 +21712,73 @@ func (vpc *VpcV1) DeleteClusterNetworkInterfaceWithContext(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, "delete_cluster_network_interface", 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, UnmarshalClusterNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// 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) +// ListSecurityGroups : List security groups +// This request lists security groups in the region. A security group defines a set of packet filtering rules to allow +// traffic in and out of the resources targeted by the security group. No traffic is allowed by default. Security group +// rules are stateful so that reverse traffic in response to allowed traffic is automatically allowed. +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 } -// 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(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions") +// 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{ - "cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID, - "id": *deleteClusterNetworkSubnetOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{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 deleteClusterNetworkSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { 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 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 { @@ -21857,12 +21789,12 @@ func (vpc *VpcV1) DeleteClusterNetworkSubnetWithContext(ctx context.Context, del var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_cluster_network_subnet", 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, UnmarshalClusterNetworkSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21873,61 +21805,72 @@ func (vpc *VpcV1) DeleteClusterNetworkSubnetWithContext(ctx context.Context, del return } -// 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) +// 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 } -// 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") +// 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(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions") + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "cluster_network_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, - "cluster_network_subnet_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, - "id": *deleteClusterNetworkSubnetReservedIPOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{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 deleteClusterNetworkSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteClusterNetworkSubnetReservedIPOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkSubnetReservedIPOptions.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 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()) @@ -21937,12 +21880,12 @@ func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIPWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21953,49 +21896,49 @@ func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIPWithContext(ctx context.Co return } -// 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) +// 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 } -// 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") +// 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(getClusterNetworkOptions, "getClusterNetworkOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getClusterNetworkOptions.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, `/cluster_networks/{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 getClusterNetworkOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -22006,66 +21949,56 @@ func (vpc *VpcV1) GetClusterNetworkWithContext(ctx context.Context, getClusterNe 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_cluster_network", 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, UnmarshalClusterNetwork) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// 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) +// 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 } -// 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") +// 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(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *getClusterNetworkInterfaceOptions.ClusterNetworkID, - "id": *getClusterNetworkInterfaceOptions.ID, + "id": *getSecurityGroupOptions.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}/interfaces/{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 getClusterNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -22082,12 +22015,12 @@ func (vpc *VpcV1) GetClusterNetworkInterfaceWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_cluster_network_interface", 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, UnmarshalClusterNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22098,53 +22031,62 @@ func (vpc *VpcV1) GetClusterNetworkInterfaceWithContext(ctx context.Context, get return } -// 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) +// 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 } -// 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") +// 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(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getClusterNetworkProfileOptions.Name, + "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, `/cluster_network/profiles/{name}`, 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 getClusterNetworkProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -22154,12 +22096,12 @@ func (vpc *VpcV1) GetClusterNetworkProfileWithContext(ctx context.Context, getCl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_cluster_network_profile", 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, UnmarshalClusterNetworkProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22170,47 +22112,47 @@ func (vpc *VpcV1) GetClusterNetworkProfileWithContext(ctx context.Context, getCl 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) +// 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 } -// 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") +// 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(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") 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, + "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, `/cluster_networks/{cluster_network_id}/subnets/{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 getClusterNetworkSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -22227,12 +22169,12 @@ func (vpc *VpcV1) GetClusterNetworkSubnetWithContext(ctx context.Context, getClu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_cluster_network_subnet", 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, UnmarshalClusterNetworkSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22243,55 +22185,65 @@ func (vpc *VpcV1) GetClusterNetworkSubnetWithContext(ctx context.Context, getClu return } -// 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) +// 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 } -// 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") +// 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(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions") + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, - "cluster_network_subnet_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, - "id": *getClusterNetworkSubnetReservedIPOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{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 getClusterNetworkSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -22301,12 +22253,12 @@ func (vpc *VpcV1) GetClusterNetworkSubnetReservedIPWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22317,69 +22269,53 @@ func (vpc *VpcV1) GetClusterNetworkSubnetReservedIPWithContext(ctx context.Conte return } -// 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) +// 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 } -// 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") +// 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(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *listClusterNetworkInterfacesOptions.ClusterNetworkID, + "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, `/cluster_networks/{cluster_network_id}/interfaces`, 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 listClusterNetworkInterfacesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") 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 { @@ -22387,69 +22323,63 @@ func (vpc *VpcV1) ListClusterNetworkInterfacesWithContext(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_cluster_network_interfaces", 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, UnmarshalClusterNetworkInterfaceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// 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) +// 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 } -// 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") +// 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, `/cluster_network/profiles`, nil) + _, 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 listClusterNetworkProfilesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listClusterNetworkProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start)) - } - if listClusterNetworkProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -22460,12 +22390,12 @@ func (vpc *VpcV1) ListClusterNetworkProfilesWithContext(ctx context.Context, lis var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_cluster_network_profiles", 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, UnmarshalClusterNetworkProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22476,64 +22406,61 @@ func (vpc *VpcV1) ListClusterNetworkProfilesWithContext(ctx context.Context, lis return } -// 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) +// 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 } -// 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") +// 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(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions") + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") 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, + "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, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, 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 listClusterNetworkSubnetReservedIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 listClusterNetworkSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start)) - } - if listClusterNetworkSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit)) - } - if listClusterNetworkSubnetReservedIpsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Name)) - } - if listClusterNetworkSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Sort)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -22545,12 +22472,12 @@ func (vpc *VpcV1) ListClusterNetworkSubnetReservedIpsWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_cluster_network_subnet_reserved_ips", 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, UnmarshalClusterNetworkSubnetReservedIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22561,64 +22488,57 @@ func (vpc *VpcV1) ListClusterNetworkSubnetReservedIpsWithContext(ctx context.Con return } -// 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) +// 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 } -// 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") +// 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(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions") + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *listClusterNetworkSubnetsOptions.ClusterNetworkID, + "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, `/cluster_networks/{cluster_network_id}/subnets`, 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 listClusterNetworkSubnetsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") 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 listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) } - if listClusterNetworkSubnetsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetsOptions.Sort)) + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) } request, err := builder.Build() @@ -22630,12 +22550,12 @@ func (vpc *VpcV1) ListClusterNetworkSubnetsWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_cluster_network_subnets", 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, UnmarshalClusterNetworkSubnetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22646,69 +22566,63 @@ func (vpc *VpcV1) ListClusterNetworkSubnetsWithContext(ctx context.Context, list 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) +// 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 } -// 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") +// 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, `/cluster_networks`, 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 listClusterNetworksOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworks") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { 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 { @@ -22716,84 +22630,65 @@ func (vpc *VpcV1) ListClusterNetworksWithContext(ctx context.Context, listCluste 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_cluster_networks", 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, UnmarshalClusterNetworkCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// 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) +// 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 } -// 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") +// 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(updateClusterNetworkOptions, "updateClusterNetworkOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateClusterNetworkOptions.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, `/cluster_networks/{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 updateClusterNetworkOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetwork") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { 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(updateClusterNetworkOptions.ClusterNetworkPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -22803,12 +22698,12 @@ func (vpc *VpcV1) UpdateClusterNetworkWithContext(ctx context.Context, updateClu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_cluster_network", 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, UnmarshalClusterNetwork) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22819,66 +22714,64 @@ func (vpc *VpcV1) UpdateClusterNetworkWithContext(ctx context.Context, updateClu return } -// 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) +// 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 } -// 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") +// 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(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *updateClusterNetworkInterfaceOptions.ClusterNetworkID, - "id": *updateClusterNetworkInterfaceOptions.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, `/cluster_networks/{cluster_network_id}/interfaces/{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 updateClusterNetworkInterfaceOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { 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()) @@ -22888,12 +22781,12 @@ func (vpc *VpcV1) UpdateClusterNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_cluster_network_interface", 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, UnmarshalClusterNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22904,64 +22797,52 @@ func (vpc *VpcV1) UpdateClusterNetworkInterfaceWithContext(ctx context.Context, return } -// 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) +// 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 } -// 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(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions") +// 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{ - "cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID, - "id": *updateClusterNetworkSubnetOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{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 updateClusterNetworkSubnetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch) - 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() @@ -22973,12 +22854,12 @@ func (vpc *VpcV1) UpdateClusterNetworkSubnetWithContext(ctx context.Context, upd var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_cluster_network_subnet", 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, UnmarshalClusterNetworkSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22989,67 +22870,53 @@ func (vpc *VpcV1) UpdateClusterNetworkSubnetWithContext(ctx context.Context, upd return } -// 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) +// 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 } -// 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") +// 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(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "cluster_network_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, - "cluster_network_subnet_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, - "id": *updateClusterNetworkSubnetReservedIPOptions.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, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{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 updateClusterNetworkSubnetReservedIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getShareProfileOptions.Headers { 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(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -23059,12 +22926,12 @@ func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIPWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_cluster_network_subnet_reserved_ip", 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, UnmarshalClusterNetworkSubnetReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23075,75 +22942,60 @@ func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIPWithContext(ctx context.Co 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) +// 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 } -// 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") +// 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, `/public_gateways`, 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 createPublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSharesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) } - if createPublicGatewayOptions.Zone != nil { - body["zone"] = createPublicGatewayOptions.Zone + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) } - if createPublicGatewayOptions.FloatingIP != nil { - body["floating_ip"] = createPublicGatewayOptions.FloatingIP + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) } - if createPublicGatewayOptions.Name != nil { - body["name"] = createPublicGatewayOptions.Name + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) } - if createPublicGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPublicGatewayOptions.ResourceGroup + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) } request, err := builder.Build() @@ -23155,12 +23007,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_shares", 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, UnmarshalShareCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23171,113 +23023,137 @@ 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) +// 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 } -// 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") +// 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(deletePublicGatewayOptions, "deletePublicGatewayOptions") + err = core.ValidateStruct(createShareOptions, "createShareOptions") 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, `/shares`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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_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 } -// 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) +// 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 } -// 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") +// 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(getPublicGatewayOptions, "getPublicGatewayOptions") + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPublicGatewayOptions.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, `/public_gateways/{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 getPublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteShareOptions.Headers { 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)) @@ -23291,12 +23167,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, "delete_share", 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, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23307,54 +23183,52 @@ 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) +// 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 } -// 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 { + 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, `/public_gateways`, nil) + _, 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 listPublicGatewaysOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getShareOptions.Headers { 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 { @@ -23365,12 +23239,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, "get_share", 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, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23381,55 +23255,59 @@ 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) +// 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 } -// 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") +// 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(updatePublicGatewayOptions, "updatePublicGatewayOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, + "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/{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 updatePublicGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateShareOptions.Headers { 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(updatePublicGatewayOptions.PublicGatewayPatch) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -23444,12 +23322,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, "update_share", 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, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23460,54 +23338,60 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl 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) +// 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 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) { + result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) 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") +// 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(createFloatingIPOptions, "createFloatingIPOptions") + err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *listShareAccessorBindingsOptions.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/{id}/accessor_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + 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() @@ -23519,12 +23403,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, "list_share_accessor_bindings", 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, UnmarshalShareAccessorBindingCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23535,47 +23419,47 @@ 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) +// 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 } -// 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") +// 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(deleteFloatingIPOptions, "deleteFloatingIPOptions") + err = core.ValidateStruct(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteFloatingIPOptions.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, `/floating_ips/{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 deleteFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -23590,7 +23474,7 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_accessor_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -23598,46 +23482,47 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin 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) +// 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 } -// 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") +// 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(getFloatingIPOptions, "getFloatingIPOptions") + err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getFloatingIPOptions.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, `/floating_ips/{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 getFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -23654,12 +23539,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, "get_share_accessor_binding", 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, UnmarshalShareAccessorBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23670,67 +23555,69 @@ 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/floating_ips`, 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 listFloatingIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range failoverShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 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)) + + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy } - if listFloatingIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout } - if listFloatingIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -23739,77 +23626,73 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp 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_floating_ips", 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, 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) +// 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 } -// 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") +// 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(updateFloatingIPOptions, "updateFloatingIPOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.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, `/floating_ips/{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 updateFloatingIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -23821,12 +23704,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, "list_share_mount_targets", 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, UnmarshalShareMountTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23837,44 +23720,49 @@ 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) +// 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 } -// 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") +// 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(createNetworkACLOptions, "createNetworkACLOptions") + 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, `/network_acls`, 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 createNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -23883,7 +23771,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(createShareMountTargetOptions.ShareMountTargetPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -23898,12 +23786,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_share_mount_target", 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, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23914,61 +23802,57 @@ 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) +// 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 } -// 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") +// 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(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.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, `/network_acls/{network_acl_id}/rules`, 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 createNetworkACLRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -23978,12 +23862,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, "delete_share_mount_target", 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, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23994,49 +23878,50 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet 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) +// 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 } -// 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") +// 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(deleteNetworkACLOptions, "deleteNetworkACLOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteNetworkACLOptions.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, `/network_acls/{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 deleteNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -24047,125 +23932,171 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") 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, + "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, `/network_acls/{network_acl_id}/rules/{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 deleteNetworkACLRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "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 } - 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, "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 } -// 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) +// 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 } -// 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") +// 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(getNetworkACLOptions, "getNetworkACLOptions") + err = core.ValidateStruct(listShareSnapshotsOptions, "listShareSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getNetworkACLOptions.ID, + "share_id": *listShareSnapshotsOptions.ShareID, } 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, `/shares/{share_id}/snapshots`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareSnapshots") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listShareSnapshotsOptions.Headers { 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 { @@ -24176,12 +24107,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, "list_share_snapshots", 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, UnmarshalShareSnapshotCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24192,54 +24123,79 @@ 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) +// 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 an `access_control_mode` of `security_group`, an +// `availability_mode` of `zonal`, and a `replication_role` of `source` or `none`. +// +// The snapshot will inherit its `resource_group` and encryption settings from the share. +// +// 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 } -// 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") +// 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(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + err = core.ValidateStruct(createShareSnapshotOptions, "createShareSnapshotOptions") 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, + "share_id": *createShareSnapshotOptions.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, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, 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 getNetworkACLRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createShareSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -24249,12 +24205,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, "create_share_snapshot", 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, UnmarshalShareSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24265,62 +24221,64 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC 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) +// 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 } -// 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") +// 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(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + err = core.ValidateStruct(deleteShareSnapshotOptions, "deleteShareSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + "share_id": *deleteShareSnapshotOptions.ShareID, + "id": *deleteShareSnapshotOptions.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, `/shares/{share_id}/snapshots/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteShareSnapshotOptions.Headers { 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 { @@ -24331,12 +24289,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, "delete_share_snapshot", 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, UnmarshalShareSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24347,55 +24305,53 @@ 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 rules for traffic in -// and out of the subnets the network ACL is attached to. No traffic is allowed by default. Both allow and deny rules -// can be defined, and rules are stateless so that reverse traffic in response to allowed traffic is not automatically -// allowed. -func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +// 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 } -// 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") +// 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, `/network_acls`, nil) + _, 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 listNetworkAclsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getShareSnapshotOptions.Headers { 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 { @@ -24406,12 +24362,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, "get_share_snapshot", 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, UnmarshalShareSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24422,55 +24378,61 @@ 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) +// 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 } -// 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") +// 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(updateNetworkACLOptions, "updateNetworkACLOptions") + err = core.ValidateStruct(updateShareSnapshotOptions, "updateShareSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, + "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, `/network_acls/{id}`, pathParamsMap) + _, 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 updateNetworkACLOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateShareSnapshotOptions.Headers { 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(updateNetworkACLOptions.NetworkACLPatch) + _, err = builder.SetBodyContentJSON(updateShareSnapshotOptions.ShareSnapshotPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -24485,12 +24447,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_share_snapshot", 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, UnmarshalShareSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24501,63 +24463,120 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork 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) +// 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 } -// 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") +// 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(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") 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, + "share_id": *deleteShareSourceOptions.ShareID, } - 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/{network_acl_id}/rules/{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 updateNetworkACLRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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) + 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_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) + 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 } + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range getShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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()) @@ -24567,12 +24586,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, "get_share_source", 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, UnmarshalShareReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24583,70 +24602,61 @@ 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) +// 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 } -// 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") +// 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.POST) + 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, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + 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() @@ -24658,12 +24668,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_snapshot_consistency_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, UnmarshalSnapshotConsistencyGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24674,51 +24684,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) +// 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 } -// 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") +// 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(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") 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, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -24727,7 +24730,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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -24742,12 +24745,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_snapshot_consistency_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, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24758,57 +24761,47 @@ 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) +// 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 } -// 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") +// 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") 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": *deleteSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -24825,12 +24818,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, "delete_snapshot_consistency_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, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24841,49 +24834,49 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, + "id": *getSnapshotConsistencyGroupOptions.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) + _, 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 deleteSecurityGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -24894,137 +24887,151 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") 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": *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, `/security_groups/{security_group_id}/rules/{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 deleteSecurityGroupRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { 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 } - 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_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 } -// 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) +// 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 } -// 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") +// 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(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") 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) + _, 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 deleteSecurityGroupTargetBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { 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 { @@ -25034,7 +25041,7 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_security_group_target_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25042,52 +25049,110 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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": *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) + _, 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 getSecurityGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSnapshotsOptions.Headers { 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 { @@ -25098,12 +25163,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, "list_snapshots", 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, UnmarshalSnapshotCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25114,54 +25179,57 @@ 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) +// 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 } -// 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") +// 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(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") 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 := 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/{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 getSecurityGroupRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -25171,12 +25239,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, "create_snapshot", 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, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25187,51 +25255,51 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri 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) +// 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 } -// 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") +// 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(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") 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": *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, `/security_groups/{security_group_id}/targets/{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 getSecurityGroupTargetOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSnapshotOptions.Headers { 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)) @@ -25242,66 +25310,56 @@ 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_snapshot", 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 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) +// 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 } -// 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") +// 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(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + "id": *getSnapshotOptions.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`, 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 listSecurityGroupRulesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -25318,12 +25376,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, "get_snapshot", 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, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25334,57 +25392,62 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec 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) +// 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 } -// 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") +// 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(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, + "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, `/security_groups/{security_group_id}/targets`, 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 listSecurityGroupTargetsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSnapshotOptions.Headers { 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)) - if listSecurityGroupTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) - } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -25396,12 +25459,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, "update_snapshot", 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, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25412,63 +25475,52 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS return } -// ListSecurityGroups : List security groups -// This request lists security groups in the region. A security group defines a set of packet filtering rules to allow -// traffic in and out of the resources targeted by the security group. No traffic is allowed by default. Security group -// rules are stateful so that reverse traffic in response to allowed traffic is automatically allowed. -func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +// 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 } -// 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") +// 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, `/security_groups`, 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 listSecurityGroupsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { 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 { @@ -25479,12 +25531,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_snapshot_clones", 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, UnmarshalSnapshotCloneCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25495,144 +25547,118 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit 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) +// 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 } -// 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") +// 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(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.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, `/security_groups/{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 updateSecurityGroupOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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_snapshot_clone", 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 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) +// 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 } -// 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") +// 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(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") 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": *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, `/security_groups/{security_group_id}/rules/{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 updateSecurityGroupRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -25642,12 +25668,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, "get_snapshot_clone", 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, UnmarshalSnapshotClone) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25658,53 +25684,51 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update 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) +// 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 } -// 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") +// 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(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") 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": *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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, 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 addVPNGatewayConnectionsLocalCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -25715,66 +25739,80 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Conte 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_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 } -// 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) +// ListSnapshotInstanceProfiles : List instance profiles compatible with a snapshot +// This request lists instance profiles compatible with a snapshot's +// `allowed_use.instance`, `operating_system.architecture` and +// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified snapshot +// must be bootable. +func (vpc *VpcV1) ListSnapshotInstanceProfiles(listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotInstanceProfilesWithContext(context.Background(), listSnapshotInstanceProfilesOptions) 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") +// ListSnapshotInstanceProfilesWithContext is an alternate form of the ListSnapshotInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotInstanceProfilesWithContext(ctx context.Context, listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions") 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": *listSnapshotInstanceProfilesOptions.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, `/snapshots/{id}/instance_profiles`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotInstanceProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSnapshotInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listSnapshotInstanceProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotInstanceProfilesOptions.Start)) + } + if listSnapshotInstanceProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotInstanceProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -25782,65 +25820,90 @@ 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_snapshot_instance_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotInstanceProfileCollection) + 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) +// 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 } -// 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") +// 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{ - "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, `/subnets`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSubnetsOptions.Headers { 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 { @@ -25848,154 +25911,215 @@ 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_subnets", 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) + 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 +} + +// 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 } -// 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") +// 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(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") 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, `/subnets`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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_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 } -// 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) +// 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 } -// 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") +// 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(createIkePolicyOptions, "createIkePolicyOptions") + err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/ike_policies`, nil) + _, 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 createIkePolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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 + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createIkePolicyOptions.IkeVersion != nil { - body["ike_version"] = createIkePolicyOptions.IkeVersion + + 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 } - if createIkePolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + + 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 } - if createIkePolicyOptions.Name != nil { - body["name"] = createIkePolicyOptions.Name + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - if createIkePolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIkePolicyOptions.ResourceGroup + + pathParamsMap := map[string]string{ + "id": *getSubnetOptions.ID, } - _, err = builder.SetBodyContentJSON(body) + + 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, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range getSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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()) @@ -26005,12 +26129,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, "get_subnet", 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, UnmarshalSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26021,70 +26145,56 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic 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) +// 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 } -// 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") +// 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(createIpsecPolicyOptions, "createIpsecPolicyOptions") + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/ipsec_policies`, nil) + _, 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 createIpsecPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSubnetOptions.Headers { 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 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(updateSubnetOptions.SubnetPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -26099,12 +26209,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, "update_subnet", 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, UnmarshalSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26115,56 +26225,53 @@ 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) +// 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 } -// 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") +// 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(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/vpn_gateways`, nil) + _, 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 createVPNGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -26174,12 +26281,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_subnet_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26190,46 +26297,46 @@ 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) +// 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 } -// 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") +// 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(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "id": *replaceSubnetNetworkACLOptions.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, `/vpn_gateways/{vpn_gateway_id}/connections`, 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 createVPNGatewayConnectionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -26238,7 +26345,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -26253,12 +26360,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, "replace_subnet_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26269,47 +26376,46 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre 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) +// 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 } -// 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") +// 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(deleteIkePolicyOptions, "deleteIkePolicyOptions") + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, + "id": *unsetSubnetPublicGatewayOptions.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, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteIkePolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -26324,7 +26430,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, "unset_subnet_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -26332,49 +26438,49 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic 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) +// 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 } -// 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") +// 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(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.ID, + "id": *getSubnetPublicGatewayOptions.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, `/ipsec_policies/{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 deleteIpsecPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26385,124 +26491,148 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.ID, + "id": *setSubnetPublicGatewayOptions.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, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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", 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, UnmarshalPublicGateway) + 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) +// 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 } -// 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") +// 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(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") 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": *getSubnetRoutingTableOptions.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, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26513,63 +26643,82 @@ 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_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 } -// 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) +// 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 } -// 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") +// 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(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, + "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, `/ike_policies/{id}`, 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 getIkePolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -26579,12 +26728,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, "replace_subnet_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26595,52 +26744,74 @@ 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) +// 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 } -// 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") +// 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(getIpsecPolicyOptions, "getIpsecPolicyOptions") + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.ID, + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, } 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, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIpsecPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { 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 { @@ -26651,12 +26822,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, "list_subnet_reserved_ips", 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, UnmarshalReservedIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26667,53 +26838,74 @@ 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) +// 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 } -// 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") +// 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(getVPNGatewayOptions, "getVPNGatewayOptions") + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, + "subnet_id": *createSubnetReservedIPOptions.SubnetID, } - 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/{id}`, 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 getVPNGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -26723,12 +26915,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, "create_subnet_reserved_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26739,50 +26931,53 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt 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) +// 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 } -// 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") +// 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(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") 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, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{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 getVPNGatewayConnectionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26793,68 +26988,63 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN 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_connection", 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, UnmarshalVPNGatewayConnection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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, `/ike_policies`, nil) + _, 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 listIkePoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { 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 { @@ -26865,12 +27055,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, "get_subnet_reserved_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26881,57 +27071,62 @@ 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 an IKE policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +// 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 } -// 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") +// 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, + "subnet_id": *updateSubnetReservedIPOptions.SubnetID, + "id": *updateSubnetReservedIPOptions.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, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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(updateSubnetReservedIPOptions.ReservedIPPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -26943,12 +27138,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_subnet_reserved_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26959,17 +27154,22 @@ 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) +// 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 } -// 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") +// 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 @@ -26978,29 +27178,32 @@ 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, `/virtual_network_interfaces`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { 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 listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) } - if listIpsecPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + 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() @@ -27012,12 +27215,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_virtual_network_interfaces", 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, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27028,57 +27231,87 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol return } -// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy -// This request lists VPN gateway connections that use an IPsec policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +// 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 } -// 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") +// 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(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") 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 := 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, `/virtual_network_interfaces`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listIpsecPolicyConnectionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Start)) + + body := make(map[string]interface{}) + if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing } - if listIpsecPolicyConnectionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Limit)) + 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() @@ -27090,12 +27323,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_virtual_network_interface", 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, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27106,61 +27339,54 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + "id": *deleteVirtualNetworkInterfacesOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { 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 { @@ -27171,12 +27397,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, "delete_virtual_network_interfaces", 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, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27187,49 +27413,46 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") 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, + "id": *getVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -27246,12 +27469,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, "get_virtual_network_interface", 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, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27262,56 +27485,62 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") 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": *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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs`, 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 listVPNGatewayConnectionsPeerCIDRsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -27321,12 +27550,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, "update_virtual_network_interface", 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, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27337,57 +27566,60 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + 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 listVPNGatewaysOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { 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 listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) } - if listVPNGatewaysOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) } - if listVPNGatewaysOptions.Mode != nil { - builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) } request, err := builder.Build() @@ -27399,12 +27631,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_network_interface_floating_ips", 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, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27415,50 +27647,47 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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) +// 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 } -// 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") +// 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(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") 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, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, 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 removeVPNGatewayConnectionsLocalCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -27473,7 +27702,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, "remove_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27481,52 +27710,51 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co 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) +// 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 } -// 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") +// 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(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") 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, + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.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}/peer/cidrs/{cidr}`, 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 removeVPNGatewayConnectionsPeerCIDROptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -27537,70 +27765,88 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(updateIkePolicyOptions, "updateIkePolicyOptions") + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.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, `/ike_policies/{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 updateIkePolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -27610,12 +27856,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, "add_network_interface_floating_ip", 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, UnmarshalFloatingIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27626,58 +27872,60 @@ 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) +// 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 } -// 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") +// 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(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, } - 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, `/ipsec_policies/{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 updateIpsecPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -27689,12 +27937,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, "list_virtual_network_interface_ips", 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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27705,140 +27953,121 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP 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) +// 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 } -// 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") +// 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(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.ID, + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.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, `/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 updateVPNGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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, "remove_virtual_network_interface_ip", 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) +// 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 } -// 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") +// 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(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") 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, + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.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, `/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 updateVPNGatewayConnectionOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -27848,12 +28077,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_virtual_network_interface_ip", 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, UnmarshalReservedIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27864,93 +28093,57 @@ 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) +// 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 } -// 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") +// 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(createVPNServerOptions, "createVPNServerOptions") + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/vpn_servers`, 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 createVPNServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -27960,12 +28153,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, "add_virtual_network_interface_ip", 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, UnmarshalReservedIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27976,70 +28169,49 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe 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) +// 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 } -// 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") +// 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{ - "vpn_server_id": *createVPNServerRouteOptions.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, `/volume/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNServerRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) } request, err := builder.Build() @@ -28051,12 +28223,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_volume_profiles", 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, UnmarshalVolumeProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28067,51 +28239,49 @@ 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) +// 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 } -// 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") +// 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(deleteVPNServerOptions, "deleteVPNServerOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, + "name": *getVolumeProfileOptions.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, `/vpn_servers/{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 deleteVPNServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVolumeProfileOptions.Headers { 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)) @@ -28122,64 +28292,90 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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{ - "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, - "id": *deleteVPNServerClientOptions.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}/clients/{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 deleteVPNServerClientOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVolumesOptions.Headers { 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.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + 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.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } request, err := builder.Build() if err != nil { @@ -28187,124 +28383,147 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") 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 := 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/{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 deleteVPNServerRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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 } - 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, "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 } -// 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) +// 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 } -// 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") +// 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(disconnectVPNClientOptions, "disconnectVPNClientOptions") + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") 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, + "id": *deleteVolumeOptions.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_servers/{vpn_server_id}/clients/{id}/disconnect`, 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 disconnectVPNClientOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVolumeOptions.Headers { 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)) @@ -28317,7 +28536,7 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "disconnect_vpn_client", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -28325,46 +28544,46 @@ 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) +// 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 } -// 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") +// 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(getVPNServerOptions, "getVPNServerOptions") + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, + "id": *getVolumeOptions.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, `/volumes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -28381,12 +28600,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, "get_volume", 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, UnmarshalVolume) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28397,54 +28616,64 @@ 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) +// 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 } -// 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") +// 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(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") 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, + "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, `/vpn_servers/{vpn_server_id}/clients/{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 getVPNServerClientOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVolumeOptions.Headers { 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()) @@ -28454,12 +28683,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, "update_volume", 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, UnmarshalVolume) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28470,53 +28699,61 @@ 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) +// ListVolumeInstanceProfiles : List instance profiles compatible with a volume +// This request lists instance profiles compatible with a volume's +// `allowed_use.instance`, `operating_system.architecture` and +// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified volume must +// be bootable (have an `operating_system` property). +func (vpc *VpcV1) ListVolumeInstanceProfiles(listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumeInstanceProfilesWithContext(context.Background(), listVolumeInstanceProfilesOptions) 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") +// ListVolumeInstanceProfilesWithContext is an alternate form of the ListVolumeInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeInstanceProfilesWithContext(ctx context.Context, listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, + "id": *listVolumeInstanceProfilesOptions.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) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}/instance_profiles`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeInstanceProfiles") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVolumeInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/plain") + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVolumeInstanceProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeInstanceProfilesOptions.Start)) + } + if listVolumeInstanceProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeInstanceProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -28524,63 +28761,76 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context 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, "list_volume_instance_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeInstanceProfileCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = 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) { - result, response, err = vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +// 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 } -// 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") +// 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{ - "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.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVpcsOptions.Headers { 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 { @@ -28591,12 +28841,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, "list_vpcs", 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, UnmarshalVPCCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28607,61 +28857,76 @@ 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) +// 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. +// +// The system will automatically create the following additional resources for the VPC: +// - Unless `address_prefix_management` is `manual`, a [default address +// prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for each zone +// - A [default network +// ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl) +// - A [default routing +// table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table) +// - A [default security +// group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group). +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 } -// 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") +// 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{ - "vpn_server_id": *listVPNServerClientsOptions.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, `/vpcs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServerClientsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement } - if listVPNServerClientsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess } - if listVPNServerClientsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) + 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() @@ -28673,12 +28938,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_vpc", 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, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28689,63 +28954,64 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe 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) +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - 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. All public +// address ranges attached to the VPC are automatically detached. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) 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") +// 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(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + "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, `/vpn_servers/{vpn_server_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 listVPNServerRoutesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCOptions.Headers { 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)) - 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 { @@ -28753,77 +29019,62 @@ 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_vpc", 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 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) +// 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 } -// 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") +// 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, `/vpn_servers`, nil) + _, 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 listVPNServersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCOptions.Headers { 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 { @@ -28834,12 +29085,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_vpc", 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, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28850,59 +29101,59 @@ 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) +// 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 } -// 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") +// 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(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, + "id": *updateVPCOptions.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, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCOptions.Headers { 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 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(updateVPNServerOptions.VPNServerPatch) + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28917,12 +29168,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_vpc", 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, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28933,62 +29184,54 @@ 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) +// 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 } -// 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") +// 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(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") 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, + "id": *getVPCDefaultNetworkACLOptions.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, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -28998,12 +29241,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, "get_vpc_default_network_acl", 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, UnmarshalDefaultNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29014,93 +29257,55 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN 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) +// 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 } -// 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") +// 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(createLoadBalancerOptions, "createLoadBalancerOptions") + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + 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, `/load_balancers`, nil) + _, 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 createLoadBalancerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -29110,12 +29315,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, "get_vpc_default_routing_table", 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, UnmarshalDefaultRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29126,94 +29331,54 @@ 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + "id": *getVPCDefaultSecurityGroupOptions.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`, 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 createLoadBalancerListenerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -29223,12 +29388,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, "get_vpc_default_security_group", 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, UnmarshalDefaultSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29239,77 +29404,57 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre 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 load balancer must be in the `application` family. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +// 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 } -// 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") +// 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(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") 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, + "vpc_id": *listVPCAddressPrefixesOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, 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 createLoadBalancerListenerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) } request, err := builder.Build() @@ -29321,12 +29466,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_vpc_address_prefixes", 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, UnmarshalAddressPrefixCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29337,48 +29482,47 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") 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, + "vpc_id": *createVPCAddressPrefixOptions.VPCID, } 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, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -29388,17 +29532,17 @@ 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 createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR } - if createLoadBalancerListenerPolicyRuleOptions.Type != nil { - body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone } - if createLoadBalancerListenerPolicyRuleOptions.Value != nil { - body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault } - if createLoadBalancerListenerPolicyRuleOptions.Field != nil { - body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -29415,12 +29559,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_vpc_address_prefix", 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, UnmarshalAddressPrefix) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29431,177 +29575,118 @@ 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) +// 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 } -// 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") +// 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(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.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}/pools`, 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 createLoadBalancerPoolOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.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.FailsafePolicy != nil { - body["failsafe_policy"] = createLoadBalancerPoolOptions.FailsafePolicy - } - 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_pool", 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, 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. -// -// The pool must not already have a member targeting a load balancer. -func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +// 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 } -// 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") +// 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(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") 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, + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.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, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -29611,12 +29696,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_vpc_address_prefix", 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, UnmarshalAddressPrefix) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29627,119 +29712,169 @@ 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) +// 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 } -// 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") +// 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(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.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/{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 deleteLoadBalancerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { 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/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 } - 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") 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, + "vpc_id": *listVPCDnsResolutionBindingsOptions.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, `/load_balancers/{load_balancer_id}/listeners/{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 deleteLoadBalancerListenerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { 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 { @@ -29747,125 +29882,170 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(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_load_balancer_listener", 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, UnmarshalVpcdnsResolutionBindingCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + 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) { - response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +// 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: +// - The VPC specified by the identifier in the URL must not already have a DNS resolution +// binding +// - The VPC specified by the identifier in the URL must have `dns.enable_hub` set to +// `false` +// - The updated DNS sharing connected topology must not contain more than one endpoint +// gateway with `allow_dns_resolution_binding` set to `true` targeting the same service. +// +// 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 } -// 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") +// 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(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{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 deleteLoadBalancerListenerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.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_load_balancer_listener_policy", 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 } -// 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{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 deleteLoadBalancerListenerPolicyRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -29876,60 +30056,69 @@ 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, "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 } -// 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, nor be the target pool in the failsafe policy for any other pool. -func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +// 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 } -// 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") +// 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(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") 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, + "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDnsResolutionBindingOptions.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, `/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 deleteLoadBalancerPoolOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -29940,126 +30129,167 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") 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, + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.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, `/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 deleteLoadBalancerPoolMemberOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "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 } - 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_member", 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, UnmarshalVpcdnsResolutionBinding) + 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) +// 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 } -// 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") +// 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(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.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, `/load_balancers/{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 getLoadBalancerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPCRoutesOptions.Headers { 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 { @@ -30070,12 +30300,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, "list_vpc_routes", 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, UnmarshalRouteCollectionVPCContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30086,54 +30316,87 @@ 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) +// 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 *CreateVPCRouteResponse, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) 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") +// 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 *CreateVPCRouteResponse, 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(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{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 getLoadBalancerListenerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -30143,12 +30406,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, "create_vpc_route", 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, UnmarshalCreateVPCRouteResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30159,51 +30422,52 @@ 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{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 getLoadBalancerListenerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -30214,68 +30478,60 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(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_load_balancer_listener_policy", 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, 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) +// 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 *GetVPCRouteResponse, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) 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") +// 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 *GetVPCRouteResponse, 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(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{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 getLoadBalancerListenerPolicyRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -30292,12 +30548,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_vpc_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, UnmarshalGetVPCRouteResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30308,54 +30564,65 @@ 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) +// 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 *UpdateVPCRouteResponse, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) 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") +// 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 *UpdateVPCRouteResponse, 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(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") 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, + "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, `/load_balancers/{load_balancer_id}/pools/{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 getLoadBalancerPoolOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -30365,12 +30632,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, "update_vpc_route", 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, UnmarshalUpdateVPCRouteResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30381,54 +30648,64 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal 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) +// 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 } -// 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") +// 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(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") 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, + "vpc_id": *listVPCRoutingTablesOptions.VPCID, } 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, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { 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 { @@ -30439,12 +30716,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, "list_vpc_routing_tables", 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, UnmarshalRoutingTableCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30455,53 +30732,89 @@ 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) +// 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, "") 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") +// 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "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, `/load_balancer/profiles/{name}`, 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 getLoadBalancerProfileOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -30511,12 +30824,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, "create_vpc_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30527,49 +30840,53 @@ 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) +// 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 } -// 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") +// 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(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.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/{id}/statistics`, 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 getLoadBalancerStatisticsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { 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)) @@ -30580,67 +30897,57 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL 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_statistics", 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, UnmarshalLoadBalancerStatistics) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, 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 listLoadBalancerListenerPoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -30657,12 +30964,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_vpc_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30673,55 +30980,65 @@ 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, 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 listLoadBalancerListenerPolicyRulesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { 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()) @@ -30731,12 +31048,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, "update_vpc_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30747,52 +31064,63 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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) +// 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 } -// 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") +// 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(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + "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, `/load_balancers/{load_balancer_id}/listeners`, 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 listLoadBalancerListenersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { 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 { @@ -30803,12 +31131,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_vpc_routing_table_routes", 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, UnmarshalRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30819,54 +31147,84 @@ 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) +// 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 } -// 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") +// 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(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") 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, + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 listLoadBalancerPoolMembersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -30876,12 +31234,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, "create_vpc_routing_table_route", 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, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30892,49 +31250,51 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li 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) +// 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 } -// 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") +// 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(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.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`, 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 listLoadBalancerPoolsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -30945,138 +31305,64 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad 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_pools", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_routing_table_route", 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 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) +// 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 } -// 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() +// 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, "", "build-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", 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 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 -} -// 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{ + "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, `/load_balancers`, nil) + _, 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 listLoadBalancersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { 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 { @@ -31087,12 +31373,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, "get_vpc_routing_table_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, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31103,61 +31389,59 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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) +// 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 } -// 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") +// 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(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") 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, + "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, + "id": *updateVPCRoutingTableRouteOptions.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, `/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 replaceLoadBalancerPoolMembersOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { 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(updateVPCRoutingTableRouteOptions.RoutePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -31172,12 +31456,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_vpc_routing_table_route", 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, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31188,63 +31472,48 @@ 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) +// 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 } -// 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") +// 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{ - "id": *updateLoadBalancerOptions.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/{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 updateLoadBalancerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listIkePoliciesOptions.Headers { 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 + 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() @@ -31256,12 +31525,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, "list_ike_policies", 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, UnmarshalIkePolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31272,56 +31541,73 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") 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 := 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, `/ike_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createIkePolicyOptions.Headers { 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + 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 @@ -31336,12 +31622,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, "create_ike_policy", 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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31352,145 +31638,116 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") 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, + "id": *deleteIkePolicyOptions.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/{id}`, 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 updateLoadBalancerListenerPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "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, "delete_ike_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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") 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, + "id": *getIkePolicyOptions.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/{listener_id}/policies/{policy_id}/rules/{id}`, 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 updateLoadBalancerListenerPolicyRuleOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -31500,12 +31757,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, "get_ike_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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31516,47 +31773,46 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") 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": *updateIkePolicyOptions.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, `/ike_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -31565,7 +31821,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -31580,12 +31836,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_ike_policy", 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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31596,60 +31852,57 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL 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) +// ListIkePolicyConnections : List VPN gateway connections that use a specified IKE policy +// This request lists VPN gateway connections that use an 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 } -// 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") +// 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(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") 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, + "id": *listIkePolicyConnectionsOptions.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}/pools/{pool_id}/members/{id}`, 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 updateLoadBalancerPoolMemberOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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 + 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() @@ -31661,12 +31914,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, "list_ike_policy_connections", 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, UnmarshalIkePolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31677,56 +31930,49 @@ 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) +// 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 } -// 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") +// 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{ - "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, `/ipsec_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { 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 { @@ -31737,12 +31983,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_ipsec_policies", 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, UnmarshalIPsecPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31753,23 +31999,22 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi 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) +// 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 } -// 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") +// 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(createEndpointGatewayOptions, "createEndpointGatewayOptions") + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -31778,18 +32023,18 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn 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, `/ipsec_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createEndpointGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -31799,26 +32044,23 @@ 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 createIpsecPolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm } - if createEndpointGatewayOptions.AllowDnsResolutionBinding != nil { - body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding + if createIpsecPolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm } - if createEndpointGatewayOptions.Ips != nil { - body["ips"] = createEndpointGatewayOptions.Ips + if createIpsecPolicyOptions.Pfs != nil { + body["pfs"] = createIpsecPolicyOptions.Pfs } - if createEndpointGatewayOptions.Name != nil { - body["name"] = createEndpointGatewayOptions.Name + if createIpsecPolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime } - if createEndpointGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + if createIpsecPolicyOptions.Name != nil { + body["name"] = createIpsecPolicyOptions.Name } - if createEndpointGatewayOptions.SecurityGroups != nil { - body["security_groups"] = createEndpointGatewayOptions.SecurityGroups + if createIpsecPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIpsecPolicyOptions.ResourceGroup } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -31835,12 +32077,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_ipsec_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, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31851,49 +32093,47 @@ 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) +// 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 } -// 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") +// 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(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, + "id": *deleteIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -31908,7 +32148,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_ipsec_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -31916,46 +32156,46 @@ 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) +// 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 } -// 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") +// 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(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, + "id": *getIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getEndpointGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -31972,12 +32212,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_ipsec_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, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31988,54 +32228,60 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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) +// 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 } -// 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") +// 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(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") 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, + "id": *updateIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -32045,12 +32291,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_ipsec_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, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32061,60 +32307,57 @@ 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) +// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy +// This request lists VPN gateway connections that use an 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 } -// 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") +// 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(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "id": *listIpsecPolicyConnectionsOptions.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`, 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 listEndpointGatewayIpsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { 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 listIpsecPolicyConnectionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Start)) } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + if listIpsecPolicyConnectionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Limit)) } request, err := builder.Build() @@ -32126,12 +32369,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, "list_ipsec_policy_connections", 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, UnmarshalIPsecPolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32142,18 +32385,17 @@ 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) +// 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 } -// 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") +// 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 @@ -32162,50 +32404,113 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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, `/vpn_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { 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 listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) } - if listEndpointGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) } - if listEndpointGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) } - if listEndpointGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + if listVPNGatewaysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) } - if listEndpointGatewaysOptions.LifecycleState != nil { - builder.AddQuery("lifecycle_state", strings.Join(listEndpointGatewaysOptions.LifecycleState, ",")) + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) } - if listEndpointGatewaysOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if listEndpointGatewaysOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) + + 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 listEndpointGatewaysOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) + 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 } - if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { - builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) + + 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range createVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.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() @@ -32217,12 +32522,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, "create_vpn_gateway", 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, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32233,48 +32538,48 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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) +// 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 } -// 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") +// 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(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") 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": *deleteVPNGatewayOptions.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, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -32289,7 +32594,7 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_endpoint_gateway_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -32297,60 +32602,53 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove 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) +// 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 } -// 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") +// 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(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.ID, + "id": *getVPNGatewayOptions.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, `/endpoint_gateways/{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 updateEndpointGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -32360,12 +32658,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, "get_vpn_gateway", 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, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32376,69 +32674,55 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn 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) +// 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 } -// 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") +// 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(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) 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, `/flow_log_collectors`, nil) + _, 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 createFlowLogCollectorOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { 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(updateVPNGatewayOptions.VPNGatewayPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -32453,12 +32737,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, "update_vpn_gateway", 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, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32469,53 +32753,61 @@ 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) +// 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 } -// 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") +// 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(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.ID, + "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, `/flow_log_collectors/{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 deleteFlowLogCollectorOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { 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 { @@ -32523,63 +32815,79 @@ 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 { - core.EnrichHTTPProblem(err, "delete_flow_log_collector", 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 } -// 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) +// 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 } -// 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") +// 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(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.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, `/flow_log_collectors/{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 getFlowLogCollectorOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -32589,12 +32897,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, "create_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32605,73 +32913,53 @@ 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 TCP and UDP 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) +// 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 } -// 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") +// 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 } - builder := core.NewRequestBuilder(core.GET) + 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, `/flow_log_collectors`, nil) + _, 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 listFlowLogCollectorsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { 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 { @@ -32679,81 +32967,64 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow 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_flow_log_collectors", 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, 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) +// 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 } -// 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") +// 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(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.ID, + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.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, `/flow_log_collectors/{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 updateFlowLogCollectorOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "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()) @@ -32763,12 +33034,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, "get_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32779,72 +33050,56 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF 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) +// 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 } -// 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") +// 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(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") 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": *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, `/private_path_service_gateways`, nil) + _, 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 createPrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { 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 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) + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -32859,12 +33114,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, "update_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32875,68 +33130,56 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context 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) +// 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 } -// 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") +// 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(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsLocalCIDRsOptions.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}/account_policies`, 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 createPrivatePathServiceGatewayAccountPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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()) @@ -32946,12 +33189,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, "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, UnmarshalPrivatePathServiceGatewayAccountPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -32962,47 +33205,50 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co 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) +// 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 } -// 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") +// 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(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deletePrivatePathServiceGatewayOptions.ID, + "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, `/private_path_service_gateways/{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 deletePrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -33017,7 +33263,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, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33025,48 +33271,50 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context 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) +// 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 } -// 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") +// 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(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") 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, + "vpn_gateway_id": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *checkVPNGatewayConnectionsLocalCIDROptions.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, `/private_path_service_gateways/{private_path_service_gateway_id}/account_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 deletePrivatePathServiceGatewayAccountPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } @@ -33081,7 +33329,7 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx co response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_private_path_service_gateway_account_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33089,65 +33337,57 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx co 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) +// 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 } -// 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") +// 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(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") 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, + "vpn_gateway_id": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR, } - 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, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny`, 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 denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { 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()) @@ -33156,7 +33396,7 @@ func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "deny_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33164,46 +33404,49 @@ func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext 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) +// 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 } -// 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") +// 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(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPrivatePathServiceGatewayOptions.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, `/private_path_service_gateways/{id}`, 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 getPrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") @@ -33220,12 +33463,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, "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, UnmarshalPrivatePathServiceGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -33236,50 +33479,52 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, g 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) +// 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 } -// 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") +// 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(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") 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, + "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, `/private_path_service_gateways/{private_path_service_gateway_id}/account_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 getPrivatePathServiceGatewayAccountPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -33290,69 +33535,62 @@ 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_vpn_gateway_connections_peer_cidr", 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 } -// 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) +// 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 } -// 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") +// 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(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") 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, + "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, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{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 getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -33363,85 +33601,66 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext( 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_endpoint_gateway_binding", 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, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding) - 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. +// 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. // -// 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) +// 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 } -// 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") +// 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(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *listPrivatePathServiceGatewayAccountPoliciesOptions.PrivatePathServiceGatewayID, + "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, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, 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 listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { 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 { @@ -33449,89 +33668,67 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(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, "list_private_path_service_gateway_account_policies", 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, UnmarshalPrivatePathServiceGatewayAccountPolicyCollection) - 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) +// 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 } -// 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") +// 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{ - "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) + _, 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 listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNServersOptions.Headers { 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 listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit)) + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status)) + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID)) + 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() @@ -33543,12 +33740,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, "list_vpn_servers", 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, UnmarshalVPNServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -33559,58 +33756,91 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContex 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) +// 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 } -// 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()) +// 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.GET) + 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, `/vpn_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } builder.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 listPrivatePathServiceGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Start)) + + body := make(map[string]interface{}) + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate } - if listPrivatePathServiceGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Limit)) + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication } - if listPrivatePathServiceGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.ResourceGroupID)) + 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() @@ -33622,12 +33852,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, "create_vpn_server", 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, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -33638,60 +33868,196 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions") + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") 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, + "id": *deleteVPNServerOptions.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}/endpoint_gateway_bindings/{id}/permit`, 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 permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range deleteVPNServerOptions.Headers { + 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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") + + for headerName, headerValue := range getVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + 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 permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil { - body["set_account_policy"] = permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + 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 +} + +// 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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range updateVPNServerOptions.Headers { + 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 @@ -33703,58 +34069,69 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") 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": *getVPNServerClientConfigurationOptions.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}/publish`, 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 publishPrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -33765,9 +34142,9 @@ func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Contex return } - response, err = vpc.Service.Request(request, nil) + response, err = vpc.Service.Request(request, &result) if err != nil { - core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33775,65 +34152,136 @@ 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) +// 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 } -// 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") +// 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(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + "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, `/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account`, 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 revokeAccountForPrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { 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)) + 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)) + } - body := make(map[string]interface{}) - if revokeAccountForPrivatePathServiceGatewayOptions.Account != nil { - body["account"] = revokeAccountForPrivatePathServiceGatewayOptions.Account + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + 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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + 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 { @@ -33843,7 +34291,7 @@ func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGatewayWithContext(ctx conte response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server_client", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33851,51 +34299,125 @@ func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGatewayWithContext(ctx conte 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) +// 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 } -// 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") +// 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(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *unpublishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + "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, `/private_path_service_gateways/{private_path_service_gateway_id}/unpublish`, 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 unpublishPrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway") + for headerName, headerValue := range getVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + for headerName, headerValue := range disconnectVPNClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -33907,7 +34429,7 @@ func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Cont response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "unpublish_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "disconnect_vpn_client", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -33915,57 +34437,150 @@ func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Cont 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) +// 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 } -// 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") +// 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(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePrivatePathServiceGatewayOptions.ID, + "vpn_server_id": *listVPNServerRoutesOptions.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, `/private_path_service_gateways/{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 updatePrivatePathServiceGatewayOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway") + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + 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 +} + +// 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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + + for headerName, headerValue := range createVPNServerRouteOptions.Headers { + 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(updatePrivatePathServiceGatewayOptions.PrivatePathServiceGatewayPatch) + 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 @@ -33980,12 +34595,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, "create_vpn_server_route", 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, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -33996,58 +34611,193 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context 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) +// 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 } -// 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") +// 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(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") 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, + "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.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, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{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 updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + 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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + for headerName, headerValue := range getVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("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 +} + +// 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 + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } builder.AddHeader("Accept", "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) + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -34062,12 +34812,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, "update_vpn_server_route", 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, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -34078,7 +34828,7 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co return } func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "2025-04-08") + return core.NewProblemComponent(DefaultServiceName, "2025-08-26") } // AccountIdentity : Identifies an account by a unique property. @@ -34952,7 +35702,7 @@ type BackupPolicyHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -35317,7 +36067,7 @@ type BackupPolicyJobStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -35938,7 +36688,7 @@ 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. + // The user tags to attach to each backup (snapshot) created by this plan. AttachUserTags []string `json:"attach_user_tags,omitempty"` ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` @@ -36543,6 +37293,9 @@ type BareMetalServer struct { // The amount of memory, truncated to whole gibibytes. Memory *int64 `json:"memory" validate:"required"` + // The metadata service configuration for the bare metal server. + MetadataService *BareMetalServerMetadataService `json:"metadata_service" 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"` @@ -36747,6 +37500,11 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataService) + 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()) @@ -37085,6 +37843,13 @@ func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, re // BareMetalServerDisk : BareMetalServerDisk struct type BareMetalServerDisk struct { + // The usage constraints to be matched against the requested bare metal server + // properties to determine compatibility. + // + // Only present for disks which are referenced in a bare metal server's `boot_target` + // property. The value of this property will be inherited from the source image at creation. + AllowedUse *BareMetalServerDiskAllowedUse `json:"allowed_use,omitempty"` + // The date and time that the disk was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -37136,6 +37901,11 @@ const ( // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalBareMetalServerDiskAllowedUse) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_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()) @@ -37175,6 +37945,41 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface return } +// BareMetalServerDiskAllowedUse : BareMetalServerDiskAllowedUse struct +type BareMetalServerDiskAllowedUse struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query + // parameter value will be used. + ApiVersion *string `json:"api_version" validate:"required"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this disk. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server" validate:"required"` +} + +// UnmarshalBareMetalServerDiskAllowedUse unmarshals an instance of BareMetalServerDiskAllowedUse from the specified map of raw messages. +func UnmarshalBareMetalServerDiskAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskAllowedUse) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerDiskCollection : BareMetalServerDiskCollection struct type BareMetalServerDiskCollection struct { // The disks for the bare metal server. @@ -37261,7 +38066,7 @@ type BareMetalServerHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -37298,6 +38103,10 @@ func UnmarshalBareMetalServerHealthReason(m map[string]json.RawMessage, result i // BareMetalServerInitialization : BareMetalServerInitialization struct type BareMetalServerInitialization struct { + // The default trusted profile configuration specified at bare metal server + // initialization. If absent, no default trusted profile was specified. + DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` + // The image the bare metal server was provisioned from. Image *ImageReference `json:"image" validate:"required"` @@ -37312,6 +38121,11 @@ type BareMetalServerInitialization struct { // 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalBareMetalServerInitializationDefaultTrustedProfile) + if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) @@ -37331,8 +38145,81 @@ func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result return } +// BareMetalServerInitializationDefaultTrustedProfile : BareMetalServerInitializationDefaultTrustedProfile struct +type BareMetalServerInitializationDefaultTrustedProfile struct { + // If set to `true`, the system created a link to the specified `target` trusted profile during server initialization. + // Regardless of whether a link was created by the system or manually using the IAM Identity service, the link will be + // automatically deleted when the server is deleted. + AutoLink *bool `json:"auto_link" validate:"required"` + + // The default IAM trusted profile to use for this bare metal server. + Target *TrustedProfileReference `json:"target" validate:"required"` +} + +// UnmarshalBareMetalServerInitializationDefaultTrustedProfile unmarshals an instance of BareMetalServerInitializationDefaultTrustedProfile from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationDefaultTrustedProfile) + 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 +} + +// BareMetalServerInitializationDefaultTrustedProfilePrototype : BareMetalServerInitializationDefaultTrustedProfilePrototype struct +type BareMetalServerInitializationDefaultTrustedProfilePrototype struct { + // If set to `true`, the system will create a link to the specified `target` trusted profile during server 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 server is deleted. + AutoLink *bool `json:"auto_link,omitempty"` + + // The default IAM trusted profile to use for this bare metal server. + Target TrustedProfileIdentityIntf `json:"target" validate:"required"` +} + +// NewBareMetalServerInitializationDefaultTrustedProfilePrototype : Instantiate BareMetalServerInitializationDefaultTrustedProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerInitializationDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *BareMetalServerInitializationDefaultTrustedProfilePrototype, err error) { + _model = &BareMetalServerInitializationDefaultTrustedProfilePrototype{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype unmarshals an instance of BareMetalServerInitializationDefaultTrustedProfilePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationDefaultTrustedProfilePrototype) + 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 +} + // BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct type BareMetalServerInitializationPrototype struct { + // The default trusted profile to be used when initializing the bare metal server. + // + // If unspecified, no default trusted profile will be made available. + DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The image to be used when provisioning the bare metal server. Image ImageIdentityIntf `json:"image" validate:"required"` @@ -37345,9 +38232,7 @@ type BareMetalServerInitializationPrototype struct { // 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. + // The user data to be made available when initializing the bare metal server. UserData *string `json:"user_data,omitempty"` } @@ -37367,6 +38252,11 @@ func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, // 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) @@ -37390,7 +38280,7 @@ func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessag // Models which "extend" this model: // - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount type BareMetalServerInitializationUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + // The administrator 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. @@ -37458,7 +38348,7 @@ type BareMetalServerLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -37497,6 +38387,136 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul return } +// BareMetalServerMetadataService : The metadata service configuration for the bare metal server. +type BareMetalServerMetadataService struct { + // Indicates whether the metadata service endpoint is available to the bare metal server. + 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"` +} + +// Constants associated with the BareMetalServerMetadataService.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 ( + BareMetalServerMetadataServiceProtocolHTTPConst = "http" + BareMetalServerMetadataServiceProtocolHTTPSConst = "https" +) + +// UnmarshalBareMetalServerMetadataService unmarshals an instance of BareMetalServerMetadataService from the specified map of raw messages. +func UnmarshalBareMetalServerMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerMetadataService) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerMetadataServicePatch : The metadata service configuration for the bare metal server. +type BareMetalServerMetadataServicePatch struct { + // Indicates whether the metadata service endpoint will be available to the bare metal server. + 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"` +} + +// Constants associated with the BareMetalServerMetadataServicePatch.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 ( + BareMetalServerMetadataServicePatchProtocolHTTPConst = "http" + BareMetalServerMetadataServicePatchProtocolHTTPSConst = "https" +) + +// UnmarshalBareMetalServerMetadataServicePatch unmarshals an instance of BareMetalServerMetadataServicePatch from the specified map of raw messages. +func UnmarshalBareMetalServerMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerMetadataServicePatch) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the BareMetalServerMetadataServicePatch +func (bareMetalServerMetadataServicePatch *BareMetalServerMetadataServicePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerMetadataServicePatch.Enabled) { + _patch["enabled"] = bareMetalServerMetadataServicePatch.Enabled + } + if !core.IsNil(bareMetalServerMetadataServicePatch.Protocol) { + _patch["protocol"] = bareMetalServerMetadataServicePatch.Protocol + } + + return +} + +// BareMetalServerMetadataServicePrototype : The metadata service configuration for the bare metal server. +type BareMetalServerMetadataServicePrototype struct { + // Indicates whether the metadata service endpoint will be available to the bare metal server. + 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"` +} + +// Constants associated with the BareMetalServerMetadataServicePrototype.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 ( + BareMetalServerMetadataServicePrototypeProtocolHTTPConst = "http" + BareMetalServerMetadataServicePrototypeProtocolHTTPSConst = "https" +) + +// UnmarshalBareMetalServerMetadataServicePrototype unmarshals an instance of BareMetalServerMetadataServicePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerMetadataServicePrototype) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct // Models which "extend" this model: // - BareMetalServerNetworkAttachmentByPci @@ -37958,9 +38978,9 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { // `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. + // The 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. // @@ -38802,6 +39822,9 @@ type BareMetalServerPatch struct { // `stopped`. EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The metadata service configuration for the bare metal server. + MetadataService *BareMetalServerMetadataServicePatch `json:"metadata_service,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"` @@ -38824,6 +39847,11 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePatch) + 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()) @@ -38852,6 +39880,9 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i if !core.IsNil(bareMetalServerPatch.EnableSecureBoot) { _patch["enable_secure_boot"] = bareMetalServerPatch.EnableSecureBoot } + if !core.IsNil(bareMetalServerPatch.MetadataService) { + _patch["metadata_service"] = bareMetalServerPatch.MetadataService.asPatch() + } if !core.IsNil(bareMetalServerPatch.Name) { _patch["name"] = bareMetalServerPatch.Name } @@ -39312,9 +40343,6 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu // 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"` @@ -39322,13 +40350,6 @@ type BareMetalServerProfileCpuArchitecture struct { Value *string `json:"value" validate:"required"` } -// Constants associated with the BareMetalServerProfileCpuArchitecture.Default property. -// The default CPU architecture for a bare metal server with this profile. -const ( - BareMetalServerProfileCpuArchitectureDefaultAmd64Const = "amd64" - BareMetalServerProfileCpuArchitectureDefaultS390xConst = "s390x" -) - // Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. // The type for this profile field. const ( @@ -39345,11 +40366,6 @@ const ( // 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()) @@ -40351,6 +41367,9 @@ type BareMetalServerPrototype struct { Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + // The metadata service configuration for the bare metal server. + MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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. // @@ -40417,6 +41436,11 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) + 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()) @@ -40661,7 +41685,7 @@ type BareMetalServerStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -41667,7 +42691,7 @@ type ClusterNetworkInterfaceLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -41963,7 +42987,7 @@ type ClusterNetworkLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -42565,7 +43589,7 @@ type ClusterNetworkSubnetLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -43041,7 +44065,7 @@ type ClusterNetworkSubnetReservedIPLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -43305,7 +44329,7 @@ type CreateBackupPolicyPlanOptions 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. + // The user tags to attach to each backup (snapshot) created by this plan. AttachUserTags []string `json:"attach_user_tags,omitempty"` ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` @@ -43563,8 +44587,8 @@ type CreateClusterNetworkAttachmentOptions struct { 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. + // 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 @@ -43977,8 +45001,15 @@ func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) * type CreateEndpointGatewayOptions struct { // 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. + // - Must not have a service endpoint that overlaps with any `service_endpoints` of + // another endpoint gateway in the VPC. + // + // If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint + // gateway with `allow_dns_resolution_binding` set to `true` in the [DNS + // sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that: + // - Has the same `target` as this endpoint gateway + // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint + // gateway. Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` // The VPC this endpoint gateway will reside in. @@ -43987,6 +45018,13 @@ type CreateEndpointGatewayOptions 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`. // + // If `true`, then there must not be another endpoint gateway with + // `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected + // topology that: + // - Has the same `target` as this endpoint gateway + // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint + // gateway. + // // 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"` @@ -44618,10 +45656,9 @@ func (options *CreateInstanceGroupManagerPolicyOptions) SetHeaders(param map[str // CreateInstanceGroupOptions : The CreateInstanceGroup options. type CreateInstanceGroupOptions struct { - // Instance template to use when creating new instances. + // The 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`. + // The specified template must not have `default_trusted_profile.auto_link` set to `true`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template" validate:"required"` // The subnets to use when creating new instances. @@ -45420,7 +46457,7 @@ type CreateLoadBalancerListenerPolicyOptions struct { // - `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 + // The 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"` @@ -45842,7 +46879,7 @@ type CreateLoadBalancerPoolMemberOptions struct { // be shared by a pool member of any other load balancer in the same VPC. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - // The weight of the server member. + // The weight of the member. // // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` // family. @@ -46362,6 +47399,64 @@ func (options *CreatePrivatePathServiceGatewayOptions) SetHeaders(param map[stri return options } +// CreatePublicAddressRangeOptions : The CreatePublicAddressRange options. +type CreatePublicAddressRangeOptions struct { + // The total number of public IPv4 addresses required. Must be a power of 2. + Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"` + + // The name for this public address range. The name must not be used by another public address range 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 target to bind this public address range to. If unspecified, the public address + // range will not be bound to a target at creation. + Target *PublicAddressRangeTargetPrototype `json:"target,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreatePublicAddressRangeOptions : Instantiate CreatePublicAddressRangeOptions +func (*VpcV1) NewCreatePublicAddressRangeOptions(ipv4AddressCount int64) *CreatePublicAddressRangeOptions { + return &CreatePublicAddressRangeOptions{ + Ipv4AddressCount: core.Int64Ptr(ipv4AddressCount), + } +} + +// SetIpv4AddressCount : Allow user to set Ipv4AddressCount +func (_options *CreatePublicAddressRangeOptions) SetIpv4AddressCount(ipv4AddressCount int64) *CreatePublicAddressRangeOptions { + _options.Ipv4AddressCount = core.Int64Ptr(ipv4AddressCount) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePublicAddressRangeOptions) SetName(name string) *CreatePublicAddressRangeOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePublicAddressRangeOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicAddressRangeOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreatePublicAddressRangeOptions) SetTarget(target *PublicAddressRangeTargetPrototype) *CreatePublicAddressRangeOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePublicAddressRangeOptions) SetHeaders(param map[string]string) *CreatePublicAddressRangeOptions { + options.Headers = param + return options +} + // CreatePublicGatewayOptions : The CreatePublicGateway options. type CreatePublicGatewayOptions struct { // The VPC this public gateway will reside in. @@ -47175,9 +48270,9 @@ type CreateVirtualNetworkInterfaceOptions struct { // `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. + // The 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. // @@ -47430,12 +48525,12 @@ 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). + // The VPC to bind this VPC to for DNS resolution. The VPC must be different from the VPC + // specified in the URL, 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. + // 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. @@ -47492,9 +48587,9 @@ type CreateVPCOptions struct { // 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). + // Setting this property to `true` is supported only for accounts that have been + // [granted approval](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure). Instead, + // use a [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to connect this VPC to Classic Infrastructure. // Deprecated: this field is deprecated and may be removed in a future release. ClassicAccess *bool `json:"classic_access,omitempty"` @@ -48376,7 +49471,8 @@ type DnsServerPrototype struct { // The DNS server IPv4 address. Address *string `json:"address,omitempty"` - // DHCP configuration for the specified zone will have this DNS server listed first. + // If specified, DHCP configuration for the specified zone will have this DNS server listed + // first. ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` } @@ -48773,7 +49869,7 @@ type DedicatedHostDisk struct { // The unique identifier for this disk. ID *string `json:"id" validate:"required"` - // Instance disks that are on this dedicated host disk. + // The instance disks that are on this dedicated host disk. InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` // The disk interface used for attaching the disk. @@ -52286,6 +53382,34 @@ func (options *DeletePrivatePathServiceGatewayOptions) SetHeaders(param map[stri return options } +// DeletePublicAddressRangeOptions : The DeletePublicAddressRange options. +type DeletePublicAddressRangeOptions struct { + // The public address range identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeletePublicAddressRangeOptions : Instantiate DeletePublicAddressRangeOptions +func (*VpcV1) NewDeletePublicAddressRangeOptions(id string) *DeletePublicAddressRangeOptions { + return &DeletePublicAddressRangeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePublicAddressRangeOptions) SetID(id string) *DeletePublicAddressRangeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePublicAddressRangeOptions) SetHeaders(param map[string]string) *DeletePublicAddressRangeOptions { + options.Headers = param + return options +} + // DeletePublicGatewayOptions : The DeletePublicGateway options. type DeletePublicGatewayOptions struct { // The public gateway identifier. @@ -53315,7 +54439,7 @@ func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) // 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. + // A link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } @@ -53390,6 +54514,9 @@ func (options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHe // DeprecateImageOptions : The DeprecateImage options. type DeprecateImageOptions struct { + // The API maturity. For the API behavior documented here, specify `beta`. + Maturity *string `json:"maturity" validate:"required"` + // The image identifier. ID *string `json:"id" validate:"required,ne="` @@ -53398,12 +54525,19 @@ type DeprecateImageOptions struct { } // NewDeprecateImageOptions : Instantiate DeprecateImageOptions -func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { +func (*VpcV1) NewDeprecateImageOptions(maturity string, id string) *DeprecateImageOptions { return &DeprecateImageOptions{ - ID: core.StringPtr(id), + Maturity: core.StringPtr(maturity), + ID: core.StringPtr(id), } } +// SetMaturity : Allow user to set Maturity +func (_options *DeprecateImageOptions) SetMaturity(maturity string) *DeprecateImageOptions { + _options.Maturity = core.StringPtr(maturity) + return _options +} + // SetID : Allow user to set ID func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { _options.ID = core.StringPtr(id) @@ -53786,7 +54920,7 @@ type EndpointGatewayLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -53838,6 +54972,13 @@ 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`. // + // If `true`, then there must not be another endpoint gateway with + // `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected + // topology that: + // - Has the same `target` as this endpoint gateway + // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint + // gateway. + // // 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"` @@ -54137,8 +55278,15 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa // 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. +// - Must not have a service endpoint that overlaps with any `service_endpoints` of +// another endpoint gateway in the VPC. +// +// If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint gateway with +// `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected +// topology that: +// - Has the same `target` as this endpoint gateway +// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint +// gateway. // // Models which "extend" this model: // - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype @@ -57520,6 +58668,34 @@ func (options *GetPrivatePathServiceGatewayOptions) SetHeaders(param map[string] return options } +// GetPublicAddressRangeOptions : The GetPublicAddressRange options. +type GetPublicAddressRangeOptions struct { + // The public address range identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetPublicAddressRangeOptions : Instantiate GetPublicAddressRangeOptions +func (*VpcV1) NewGetPublicAddressRangeOptions(id string) *GetPublicAddressRangeOptions { + return &GetPublicAddressRangeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPublicAddressRangeOptions) SetID(id string) *GetPublicAddressRangeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPublicAddressRangeOptions) SetHeaders(param map[string]string) *GetPublicAddressRangeOptions { + options.Headers = param + return options +} + // GetPublicGatewayOptions : The GetPublicGateway options. type GetPublicGatewayOptions struct { // The public gateway identifier. @@ -60046,6 +61222,10 @@ func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interfac // Image : Image struct type Image struct { + // The usage constraints to match against the requested instance or bare metal server + // properties to determine compatibility. + AllowedUse *ImageAllowedUse `json:"allowed_use" validate:"required"` + CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` // The date and time that the image was created. @@ -60068,7 +61248,7 @@ type Image struct { // 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. + // The metadata for the imported image file. File *ImageFile `json:"file" validate:"required"` // The URL for this image. @@ -60093,10 +61273,9 @@ type Image struct { // The operating system included in this image. OperatingSystem *OperatingSystem `json:"operating_system" validate:"required"` - // The owner type of this image: - // - `user`: Owned by this account - // - `provider`: Owned by a different account. - OwnerType *string `json:"owner_type" 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 group for this image. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -60110,19 +61289,23 @@ type Image struct { 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 + // - available: image can be used to create resources + // - deleting: image is being deleted, and can no longer be used to create + // resources + // - deprecated: image is slated to be deleted, but can still be used to create + // resources + // - failed: image was not created successfully, and cannot be used to create // 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` + // - obsolete: image is slated to be deleted, and can no longer be used to create + // resources + // - pending: image is being imported, and cannot yet be used to create resources // - 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"` + // The reasons for the current status (if any). StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` // The user data format for this image: @@ -60147,15 +61330,6 @@ const ( ImageEncryptionUserManagedConst = "user_managed" ) -// Constants associated with the Image.OwnerType property. -// The owner type of this image: -// - `user`: Owned by this account -// - `provider`: Owned by a different account. -const ( - ImageOwnerTypeProviderConst = "provider" - ImageOwnerTypeUserConst = "user" -) - // Constants associated with the Image.ResourceType property. // The resource type. const ( @@ -60164,13 +61338,16 @@ 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 +// - available: image can be used to create resources +// - deleting: image is being deleted, and can no longer be used to create +// resources +// - deprecated: image is slated to be deleted, but can still be used to create +// resources +// - failed: image was not created successfully, and cannot be used to create +// resources +// - obsolete: image is slated to be deleted, and can no longer be used to create // 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` +// - pending: image is being imported, and cannot yet be used to create resources // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // // The enumerated values for this property may @@ -60211,6 +61388,11 @@ 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, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUse) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) if err != nil { err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) @@ -60276,9 +61458,9 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "owner_type", &obj.OwnerType) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote) if err != nil { - err = core.SDKErrorf(err, "", "owner_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) @@ -60320,6 +61502,241 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error return } +// ImageAllowedUse : ImageAllowedUse struct +type ImageAllowedUse struct { + // The API version with which to evaluate the expressions. + ApiVersion *string `json:"api_version" validate:"required"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `BareMetalServer` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server" validate:"required"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance" validate:"required"` +} + +// UnmarshalImageAllowedUse unmarshals an instance of ImageAllowedUse from the specified map of raw messages. +func UnmarshalImageAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageAllowedUse) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageAllowedUsePatch : ImageAllowedUsePatch struct +type ImageAllowedUsePatch struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalImageAllowedUsePatch unmarshals an instance of ImageAllowedUsePatch from the specified map of raw messages. +func UnmarshalImageAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageAllowedUsePatch) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the ImageAllowedUsePatch +func (imageAllowedUsePatch *ImageAllowedUsePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(imageAllowedUsePatch.ApiVersion) { + _patch["api_version"] = imageAllowedUsePatch.ApiVersion + } + if !core.IsNil(imageAllowedUsePatch.BareMetalServer) { + _patch["bare_metal_server"] = imageAllowedUsePatch.BareMetalServer + } + if !core.IsNil(imageAllowedUsePatch.Instance) { + _patch["instance"] = imageAllowedUsePatch.Instance + } + + return +} + +// ImageAllowedUsePrototype : ImageAllowedUsePrototype struct +type ImageAllowedUsePrototype struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query + // parameter value will be used. + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalImageAllowedUsePrototype unmarshals an instance of ImageAllowedUsePrototype from the specified map of raw messages. +func UnmarshalImageAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageAllowedUsePrototype) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageBareMetalServerProfileCollection : ImageBareMetalServerProfileCollection struct +type ImageBareMetalServerProfileCollection struct { + // A page of bare metal server profiles compatible with the image. + BareMetalServerProfiles []BareMetalServerProfileReference `json:"bare_metal_server_profiles" 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"` +} + +// UnmarshalImageBareMetalServerProfileCollection unmarshals an instance of ImageBareMetalServerProfileCollection from the specified map of raw messages. +func UnmarshalImageBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageBareMetalServerProfileCollection) + err = core.UnmarshalModel(m, "bare_metal_server_profiles", &obj.BareMetalServerProfiles, UnmarshalBareMetalServerProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server_profiles-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 *ImageBareMetalServerProfileCollection) 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 +} + // ImageCatalogOffering : ImageCatalogOffering struct type ImageCatalogOffering struct { // Indicates whether this image is managed as part of a @@ -60639,7 +62056,7 @@ type ImageExportJobStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -60695,13 +62112,13 @@ func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, // ImageFile : ImageFile struct type ImageFile struct { - // Checksums for this image file. + // The checksums for the imported 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. + // The size of the imported image file, rounded up to the next gigabyte. // // This property may be absent if the associated image has a `status` of `pending` or // `failed`. @@ -60822,8 +62239,78 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e return } +// ImageInstanceProfileCollection : ImageInstanceProfileCollection struct +type ImageInstanceProfileCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // A page of instance profiles compatible with the image. + InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `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"` +} + +// UnmarshalImageInstanceProfileCollection unmarshals an instance of ImageInstanceProfileCollection from the specified map of raw messages. +func UnmarshalImageInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageInstanceProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "instance_profiles-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 *ImageInstanceProfileCollection) 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 +} + // ImagePatch : ImagePatch struct type ImagePatch struct { + // The usage constraints to be matched against the requested instance or bare metal server + // properties to determine compatibility. + AllowedUse *ImageAllowedUsePatch `json:"allowed_use,omitempty"` + // 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 @@ -60865,6 +62352,11 @@ type ImagePatch struct { // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePatch) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) @@ -60887,6 +62379,9 @@ 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) { _patch = map[string]interface{}{} + if !core.IsNil(imagePatch.AllowedUse) { + _patch["allowed_use"] = imagePatch.AllowedUse.asPatch() + } if !core.IsNil(imagePatch.DeprecationAt) { _patch["deprecation_at"] = imagePatch.DeprecationAt } @@ -60905,6 +62400,10 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro // - ImagePrototypeImageByFile // - ImagePrototypeImageBySourceVolume type ImagePrototype struct { + // The usage constraints to match against the requested instance or bare metal server + // properties to determine compatibility. + AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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` @@ -60982,6 +62481,11 @@ 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) @@ -61105,6 +62609,26 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( 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"` +} + +// 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ImageRemoteContextImageReference : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type ImageRemoteContextImageReference struct { @@ -61156,7 +62680,7 @@ type ImageStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -61217,7 +62741,7 @@ type Instance struct { // interfaces and storage volumes of the virtual server instance. Bandwidth *int64 `json:"bandwidth" validate:"required"` - // Boot volume attachment. + // The boot volume attachment for this virtual server instance. BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` // If present, this virtual server instance was provisioned from a @@ -61747,11 +63271,13 @@ func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) ( return } -// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct +// InstanceAvailabilityPolicy : The availability policy for this virtual server instance. 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 + // - `restart`: Restart the virtual server instance + // - `stop`: Leave the virtual server instance stopped + // + // See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -61760,8 +63286,10 @@ type InstanceAvailabilityPolicy struct { // 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 +// - `restart`: Restart the virtual server instance +// - `stop`: Leave the virtual server instance stopped +// +// See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -61784,16 +63312,16 @@ func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result in // 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 action to perform if the compute host experiences a failure: + // - `restart`: Restart the virtual server instance + // - `stop`: Leave the virtual server instance stopped. 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 action to perform if the compute host experiences a failure: +// - `restart`: Restart the virtual server instance +// - `stop`: Leave the virtual server instance stopped. const ( InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" @@ -61821,18 +63349,22 @@ func (instanceAvailabilityPolicyPatch *InstanceAvailabilityPolicyPatch) asPatch( return } -// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct +// InstanceAvailabilityPolicyPrototype : The availability policy to use for this virtual server instance. 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 action to perform if the compute host experiences a failure: + // - `restart`: Restart the virtual server instance + // - `stop`: Leave the virtual server instance stopped + // + // See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. 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. +// The action to perform if the compute host experiences a failure: +// - `restart`: Restart the virtual server instance +// - `stop`: Leave the virtual server instance stopped +// +// See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. const ( InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" @@ -62203,7 +63735,7 @@ type InstanceClusterNetworkAttachmentLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -62272,8 +63804,8 @@ func (instanceClusterNetworkAttachmentPatch *InstanceClusterNetworkAttachmentPat } // 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. +// 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 @@ -62362,8 +63894,8 @@ func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface(m // 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. + // 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 @@ -62838,6 +64370,7 @@ type InstanceGpu struct { // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( + InstanceGpuManufacturerAmdConst = "amd" InstanceGpuManufacturerIntelConst = "intel" InstanceGpuManufacturerNvidiaConst = "nvidia" ) @@ -63134,7 +64667,7 @@ type InstanceGroupLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -64853,10 +66386,9 @@ type InstanceGroupPatch struct { // 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. + // The 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`. + // The specified template must not have `default_trusted_profile.auto_link` set to `true`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` // The load balancer associated with `load_balancer_pool`. @@ -65024,7 +66556,7 @@ type InstanceHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -65175,7 +66707,7 @@ type InstanceLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -65624,9 +67156,9 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface struct { // `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. + // The 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. // @@ -65868,7 +67400,6 @@ func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, r // InstancePatch : InstancePatch struct 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. @@ -65890,8 +67421,10 @@ 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"` @@ -66076,7 +67609,7 @@ func (instancePatchProfile *InstancePatchProfile) asPatch() (_patch map[string]i return } -// InstancePlacementTarget : InstancePlacementTarget struct +// InstancePlacementTarget : The placement restrictions for the virtual server instance. // Models which "extend" this model: // - InstancePlacementTargetDedicatedHostGroupReference // - InstancePlacementTargetDedicatedHostReference @@ -66153,7 +67686,11 @@ func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result inter return } -// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct +// InstancePlacementTargetPatch : 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`. // Models which "extend" this model: // - InstancePlacementTargetPatchDedicatedHostIdentity // - InstancePlacementTargetPatchDedicatedHostGroupIdentity @@ -66215,7 +67752,9 @@ func (instancePlacementTargetPatch *InstancePlacementTargetPatch) asPatch() (_pa return } -// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct +// InstancePlacementTargetPrototype : The placement restrictions to use for the virtual server instance. +// +// If specified, `reservation_affinity.policy` must be `disabled`. // Models which "extend" this model: // - InstancePlacementTargetPrototypeDedicatedHostIdentity // - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity @@ -66330,7 +67869,7 @@ type InstanceProfile struct { VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` - VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` + VcpuManufacturer InstanceProfileVcpuManufacturerIntf `json:"vcpu_manufacturer" validate:"required"` } // Constants associated with the InstanceProfile.ResourceType property. @@ -67040,6 +68579,7 @@ const ( // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( + InstanceProfileGpuManufacturerValuesAmdConst = "amd" InstanceProfileGpuManufacturerValuesIntelConst = "intel" InstanceProfileGpuManufacturerValuesNvidiaConst = "nvidia" ) @@ -67833,12 +69373,15 @@ func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, resu } // InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct +// Models which "extend" this model: +// - InstanceProfileVcpuManufacturerFixed +// - InstanceProfileVcpuManufacturerDependent type InstanceProfileVcpuManufacturer struct { // The type for this profile field. - Type *string `json:"type" validate:"required"` + Type *string `json:"type,omitempty"` // The VCPU manufacturer for an instance with this profile. - Value *string `json:"value" validate:"required"` + Value *string `json:"value,omitempty"` } // Constants associated with the InstanceProfileVcpuManufacturer.Type property. @@ -67855,6 +69398,14 @@ const ( InstanceProfileVcpuManufacturerValueIntelConst = "intel" ) +func (*InstanceProfileVcpuManufacturer) isaInstanceProfileVcpuManufacturer() bool { + return true +} + +type InstanceProfileVcpuManufacturerIntf interface { + isaInstanceProfileVcpuManufacturer() bool +} + // 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) @@ -68026,6 +69577,7 @@ type InstancePrototype struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + // The reservation affinity settings for this virtual server instance. ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` // The resource group to use. If unspecified, the account's [default resource @@ -68037,8 +69589,8 @@ type InstancePrototype struct { // `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. + // The [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. @@ -68403,7 +69955,7 @@ func (instanceReservationAffinityPatch *InstanceReservationAffinityPatch) asPatc return } -// InstanceReservationAffinityPrototype : InstanceReservationAffinityPrototype struct +// InstanceReservationAffinityPrototype : The reservation affinity settings for this virtual server instance. type InstanceReservationAffinityPrototype struct { // The reservation affinity policy to use for this virtual server instance: // - `disabled`: Reservations will not be used @@ -68473,7 +70025,7 @@ type InstanceStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -68595,6 +70147,7 @@ type InstanceTemplate struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + // The reservation affinity settings for this virtual server instance. ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` // The resource group for this instance template. @@ -68605,8 +70158,8 @@ type InstanceTemplate struct { // `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. + // The [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. @@ -69022,6 +70575,7 @@ type InstanceTemplatePrototype struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + // The reservation affinity settings for this virtual server instance. ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` // The resource group to use. If unspecified, the account's [default resource @@ -69033,8 +70587,8 @@ type InstanceTemplatePrototype struct { // `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. + // The [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. @@ -69294,7 +70848,8 @@ type InstanceVcpu struct { // The number of VCPUs assigned. Count *int64 `json:"count" validate:"required"` - // The VCPU manufacturer. + // The VCPU manufacturer for this instance. It may be `unassigned` when instance `status` is `failed`, `pending`, or + // `stopped`. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -69312,14 +70867,16 @@ const ( ) // Constants associated with the InstanceVcpu.Manufacturer property. -// The VCPU manufacturer. +// The VCPU manufacturer for this instance. It may be `unassigned` when instance `status` is `failed`, `pending`, or +// `stopped`. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - InstanceVcpuManufacturerAmdConst = "amd" - InstanceVcpuManufacturerIBMConst = "ibm" - InstanceVcpuManufacturerIntelConst = "intel" + InstanceVcpuManufacturerAmdConst = "amd" + InstanceVcpuManufacturerIBMConst = "ibm" + InstanceVcpuManufacturerIntelConst = "intel" + InstanceVcpuManufacturerUnassignedConst = "unassigned" ) // UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. @@ -69352,8 +70909,11 @@ type Key struct { // 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 + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as // `SHA256`). + // + // The length of this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Fingerprint *string `json:"fingerprint" validate:"required"` // The URL for this key. @@ -69531,8 +71091,11 @@ type KeyIdentity struct { // 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 + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as // `SHA256`). + // + // The length of this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Fingerprint *string `json:"fingerprint,omitempty"` } @@ -69608,8 +71171,11 @@ type KeyReference struct { // some supplementary information. Deleted *Deleted `json:"deleted,omitempty"` - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as // `SHA256`). + // + // The length of this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Fingerprint *string `json:"fingerprint" validate:"required"` // The URL for this key. @@ -71288,6 +72854,52 @@ func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]stri return options } +// ListImageBareMetalServerProfilesOptions : The ListImageBareMetalServerProfiles options. +type ListImageBareMetalServerProfilesOptions struct { + // The image 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 +} + +// NewListImageBareMetalServerProfilesOptions : Instantiate ListImageBareMetalServerProfilesOptions +func (*VpcV1) NewListImageBareMetalServerProfilesOptions(id string) *ListImageBareMetalServerProfilesOptions { + return &ListImageBareMetalServerProfilesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListImageBareMetalServerProfilesOptions) SetID(id string) *ListImageBareMetalServerProfilesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListImageBareMetalServerProfilesOptions) SetStart(start string) *ListImageBareMetalServerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListImageBareMetalServerProfilesOptions) SetLimit(limit int64) *ListImageBareMetalServerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImageBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListImageBareMetalServerProfilesOptions { + options.Headers = param + return options +} + // ListImageExportJobsOptions : The ListImageExportJobs options. type ListImageExportJobsOptions struct { // The image identifier. @@ -71325,6 +72937,52 @@ func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) * return options } +// ListImageInstanceProfilesOptions : The ListImageInstanceProfiles options. +type ListImageInstanceProfilesOptions struct { + // The image 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 +} + +// NewListImageInstanceProfilesOptions : Instantiate ListImageInstanceProfilesOptions +func (*VpcV1) NewListImageInstanceProfilesOptions(id string) *ListImageInstanceProfilesOptions { + return &ListImageInstanceProfilesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListImageInstanceProfilesOptions) SetID(id string) *ListImageInstanceProfilesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListImageInstanceProfilesOptions) SetStart(start string) *ListImageInstanceProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListImageInstanceProfilesOptions) SetLimit(limit int64) *ListImageInstanceProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImageInstanceProfilesOptions) SetHeaders(param map[string]string) *ListImageInstanceProfilesOptions { + options.Headers = param + return options +} + // ListImagesOptions : The ListImages options. type ListImagesOptions struct { // A server-provided token determining what resource to start the page on. @@ -71349,8 +73007,11 @@ type ListImagesOptions struct { // values. UserDataFormat []string `json:"user_data_format,omitempty"` - // Filters the collection to images with an `owner_type` property matching the specified value. - OwnerType *string `json:"owner_type,omitempty"` + // Filters the collection to images with a `remote.account.id` property matching the specified account identifier. + // + // This parameter also supports the values null and not:null which filter the collection to resources which have no + // remote account identifier or any remote account identifier, respectively. + RemoteAccountID *string `json:"remote.account.id,omitempty"` // Allows users to set headers on API requests. Headers map[string]string @@ -71381,13 +73042,6 @@ const ( ListImagesOptionsUserDataFormatIpxeConst = "ipxe" ) -// Constants associated with the ListImagesOptions.OwnerType property. -// Filters the collection to images with an `owner_type` property matching the specified value. -const ( - ListImagesOptionsOwnerTypeProviderConst = "provider" - ListImagesOptionsOwnerTypeUserConst = "user" -) - // NewListImagesOptions : Instantiate ListImagesOptions func (*VpcV1) NewListImagesOptions() *ListImagesOptions { return &ListImagesOptions{} @@ -71435,9 +73089,9 @@ func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *L return _options } -// SetOwnerType : Allow user to set OwnerType -func (_options *ListImagesOptions) SetOwnerType(ownerType string) *ListImagesOptions { - _options.OwnerType = core.StringPtr(ownerType) +// SetRemoteAccountID : Allow user to set RemoteAccountID +func (_options *ListImagesOptions) SetRemoteAccountID(remoteAccountID string) *ListImagesOptions { + _options.RemoteAccountID = core.StringPtr(remoteAccountID) return _options } @@ -72429,6 +74083,12 @@ type ListLoadBalancerPoolMembersOptions struct { // The pool identifier. PoolID *string `json:"pool_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 } @@ -72453,6 +74113,18 @@ func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *Li return _options } +// SetStart : Allow user to set Start +func (_options *ListLoadBalancerPoolMembersOptions) SetStart(start string) *ListLoadBalancerPoolMembersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancerPoolMembersOptions) SetLimit(limit int64) *ListLoadBalancerPoolMembersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { options.Headers = param @@ -72974,6 +74646,50 @@ func (options *ListPrivatePathServiceGatewaysOptions) SetHeaders(param map[strin return options } +// ListPublicAddressRangesOptions : The ListPublicAddressRanges options. +type ListPublicAddressRangesOptions 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 +} + +// NewListPublicAddressRangesOptions : Instantiate ListPublicAddressRangesOptions +func (*VpcV1) NewListPublicAddressRangesOptions() *ListPublicAddressRangesOptions { + return &ListPublicAddressRangesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPublicAddressRangesOptions) SetStart(start string) *ListPublicAddressRangesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPublicAddressRangesOptions) SetLimit(limit int64) *ListPublicAddressRangesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListPublicAddressRangesOptions) SetResourceGroupID(resourceGroupID string) *ListPublicAddressRangesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPublicAddressRangesOptions) SetHeaders(param map[string]string) *ListPublicAddressRangesOptions { + options.Headers = param + return options +} + // ListPublicGatewaysOptions : The ListPublicGateways options. type ListPublicGatewaysOptions struct { // A server-provided token determining what resource to start the page on. @@ -73738,6 +75454,52 @@ func (options *ListSnapshotConsistencyGroupsOptions) SetHeaders(param map[string return options } +// ListSnapshotInstanceProfilesOptions : The ListSnapshotInstanceProfiles options. +type ListSnapshotInstanceProfilesOptions struct { + // The snapshot 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 +} + +// NewListSnapshotInstanceProfilesOptions : Instantiate ListSnapshotInstanceProfilesOptions +func (*VpcV1) NewListSnapshotInstanceProfilesOptions(id string) *ListSnapshotInstanceProfilesOptions { + return &ListSnapshotInstanceProfilesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListSnapshotInstanceProfilesOptions) SetID(id string) *ListSnapshotInstanceProfilesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSnapshotInstanceProfilesOptions) SetStart(start string) *ListSnapshotInstanceProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSnapshotInstanceProfilesOptions) SetLimit(limit int64) *ListSnapshotInstanceProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotInstanceProfilesOptions) SetHeaders(param map[string]string) *ListSnapshotInstanceProfilesOptions { + options.Headers = param + return options +} + // ListSnapshotsOptions : The ListSnapshots options. type ListSnapshotsOptions struct { // A server-provided token determining what resource to start the page on. @@ -74294,6 +76056,52 @@ func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string] return options } +// ListVolumeInstanceProfilesOptions : The ListVolumeInstanceProfiles options. +type ListVolumeInstanceProfilesOptions struct { + // The volume 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 +} + +// NewListVolumeInstanceProfilesOptions : Instantiate ListVolumeInstanceProfilesOptions +func (*VpcV1) NewListVolumeInstanceProfilesOptions(id string) *ListVolumeInstanceProfilesOptions { + return &ListVolumeInstanceProfilesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListVolumeInstanceProfilesOptions) SetID(id string) *ListVolumeInstanceProfilesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVolumeInstanceProfilesOptions) SetStart(start string) *ListVolumeInstanceProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumeInstanceProfilesOptions) SetLimit(limit int64) *ListVolumeInstanceProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumeInstanceProfilesOptions) SetHeaders(param map[string]string) *ListVolumeInstanceProfilesOptions { + options.Headers = param + return options +} + // ListVolumeProfilesOptions : The ListVolumeProfiles options. type ListVolumeProfilesOptions struct { // A server-provided token determining what resource to start the page on. @@ -75280,7 +77088,7 @@ type LoadBalancer struct { // The supported `failsafe_policy.action` values for this load balancer's pools. FailsafePolicyActions []string `json:"failsafe_policy_actions" validate:"required"` - // Fully qualified domain name assigned to this load balancer. + // The fully qualified domain name assigned to this load balancer. Hostname *string `json:"hostname" validate:"required"` // The URL for this load balancer. @@ -76548,7 +78356,7 @@ type LoadBalancerListenerPolicy struct { // 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 + // The 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"` @@ -76678,7 +78486,7 @@ 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 + // The 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"` @@ -76748,7 +78556,7 @@ type LoadBalancerListenerPolicyPrototype struct { // 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 + // The 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"` @@ -78851,7 +80659,7 @@ 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. + // The health of the member. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -78880,14 +80688,14 @@ type LoadBalancerPoolMember struct { // The pool member target. Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` - // The weight of the server member. + // The weight of the member. // // This property will be present 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. +// The health of the member. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -78959,22 +80767,70 @@ func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interf // LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct type LoadBalancerPoolMemberCollection struct { - // The members for the load balancer pool. + // 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 page of members for the load balancer pool. Members []LoadBalancerPoolMember `json:"members" 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"` } // 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, "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, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "members-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 *LoadBalancerPoolMemberCollection) 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 +} + // 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 @@ -78999,7 +80855,7 @@ type LoadBalancerPoolMemberPatch struct { // be shared by a pool member of any other load balancer in the same VPC. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` - // The weight of the server member. + // The weight of the member. // // If specified, the pool algorithm must be `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` @@ -79067,7 +80923,7 @@ type LoadBalancerPoolMemberPrototype struct { // be shared by a pool member of any other load balancer in the same VPC. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - // The weight of the server member. + // The weight of the member. // // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` // family. @@ -80575,16 +82431,16 @@ func UnmarshalLoadBalancerReference(m map[string]json.RawMessage, result interfa // LoadBalancerStatistics : LoadBalancerStatistics struct type LoadBalancerStatistics struct { - // Number of active connections of this load balancer. + // The number of active connections for this load balancer. ActiveConnections *int64 `json:"active_connections" validate:"required"` - // Current connection rate (connections per second) of this load balancer. + // The current connection rate (connections per second) for this load balancer. ConnectionRate *float32 `json:"connection_rate" validate:"required"` - // Total number of data processed (bytes) of this load balancer within current calendar month. + // The total number of bytes processed for this load balancer for the current calendar month. DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` - // Current throughput (Mbps) of this load balancer. + // The current throughput (in Mbps) for this load balancer. Throughput *float32 `json:"throughput" validate:"required"` } @@ -81002,7 +82858,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 name of the network protocol. + // The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -81055,7 +82911,7 @@ const ( ) // Constants associated with the NetworkACLRule.Protocol property. -// The name of the network protocol. +// The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -81307,7 +83163,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 name of the network protocol. + // The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -81360,7 +83216,7 @@ const ( ) // Constants associated with the NetworkACLRuleItem.Protocol property. -// The name of the network protocol. +// The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -81624,7 +83480,7 @@ type NetworkACLRulePrototype struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The name of the network protocol. + // 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. @@ -81686,7 +83542,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeProtocolAllConst = "all" NetworkACLRulePrototypeProtocolIcmpConst = "icmp" @@ -81704,42 +83560,78 @@ type NetworkACLRulePrototypeIntf interface { // 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) + obj := new(NetworkACLRulePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) 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, "", "action-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.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "before-error", 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()) + 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, "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, "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, "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, "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 } @@ -81765,7 +83657,7 @@ type NetworkACLRulePrototypeNetworkACLContext struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The name of the network protocol. + // 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. @@ -81827,7 +83719,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" @@ -81845,42 +83737,73 @@ type NetworkACLRulePrototypeNetworkACLContextIntf interface { // 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) + obj := new(NetworkACLRulePrototypeNetworkACLContext) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) 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, "", "action-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, "destination", &obj.Destination) + if err != nil { + err = core.SDKErrorf(err, "", "destination-error", 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()) + 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, "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, "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, "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, "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 } @@ -82488,6 +84411,9 @@ func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage // ObsoleteImageOptions : The ObsoleteImage options. type ObsoleteImageOptions struct { + // The API maturity. For the API behavior documented here, specify `beta`. + Maturity *string `json:"maturity" validate:"required"` + // The image identifier. ID *string `json:"id" validate:"required,ne="` @@ -82496,12 +84422,19 @@ type ObsoleteImageOptions struct { } // NewObsoleteImageOptions : Instantiate ObsoleteImageOptions -func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { +func (*VpcV1) NewObsoleteImageOptions(maturity string, id string) *ObsoleteImageOptions { return &ObsoleteImageOptions{ - ID: core.StringPtr(id), + Maturity: core.StringPtr(maturity), + ID: core.StringPtr(id), } } +// SetMaturity : Allow user to set Maturity +func (_options *ObsoleteImageOptions) SetMaturity(maturity string) *ObsoleteImageOptions { + _options.Maturity = core.StringPtr(maturity) + return _options +} + // SetID : Allow user to set ID func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { _options.ID = core.StringPtr(id) @@ -82516,13 +84449,13 @@ func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *Obsole // OperatingSystem : OperatingSystem struct type OperatingSystem struct { - // Users may create new images with this operating system. + // Indicates that 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"` - // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + // Indicates that images with this operating system can only be used on dedicated hosts and dedicated host groups. DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` // A unique, display-friendly name for the operating system. @@ -83675,6 +85608,8 @@ type PrivatePathServiceGatewayPatch struct { // the VPC. Name *string `json:"name,omitempty"` + // Indicates whether this private path service gateway has zonal affinity. + // // 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 @@ -83767,60 +85702,74 @@ func UnmarshalPrivatePathServiceGatewayRemote(m map[string]json.RawMessage, resu return } -// PublicGateway : PublicGateway struct -type PublicGateway struct { - // The date and time that the public gateway was created. +// PublicAddressRange : PublicAddressRange struct +type PublicAddressRange struct { + // The public IPv4 range, expressed in CIDR format. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that the public address range was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The CRN for this public gateway. + // The CRN for this public address range. 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. + // The URL for this public address range. Href *string `json:"href" validate:"required"` - // The unique identifier for this public gateway. + // The unique identifier for this public address range. ID *string `json:"id" validate:"required"` - // The name for this public gateway. The name is unique across all public gateways in the VPC. + // The number of IPv4 addresses in this public address range. + Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"` + + // The lifecycle state of the public address range. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this public address range. The name is unique across all public address ranges in the region. Name *string `json:"name" validate:"required"` - // The resource group for this public gateway. + // The resource group for this public address range. 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"` + // The target this public address range is bound to. + // + // If absent, this pubic address range is not bound to a target. + // + // The target resources supported by this property is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future + // targets may omit the `vpc` property. + Target *PublicAddressRangeTarget `json:"target,omitempty"` } -// Constants associated with the PublicGateway.ResourceType property. -// The resource type. +// Constants associated with the PublicAddressRange.LifecycleState property. +// The lifecycle state of the public address range. const ( - PublicGatewayResourceTypePublicGatewayConst = "public_gateway" + PublicAddressRangeLifecycleStateDeletingConst = "deleting" + PublicAddressRangeLifecycleStateFailedConst = "failed" + PublicAddressRangeLifecycleStatePendingConst = "pending" + PublicAddressRangeLifecycleStateStableConst = "stable" + PublicAddressRangeLifecycleStateSuspendedConst = "suspended" + PublicAddressRangeLifecycleStateUpdatingConst = "updating" + PublicAddressRangeLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the PublicGateway.Status property. -// The status of this public gateway. +// Constants associated with the PublicAddressRange.ResourceType property. +// The resource type. const ( - PublicGatewayStatusAvailableConst = "available" - PublicGatewayStatusDeletingConst = "deleting" - PublicGatewayStatusFailedConst = "failed" - PublicGatewayStatusPendingConst = "pending" + PublicAddressRangeResourceTypePublicAddressRangeConst = "public_address_range" ) -// 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) +// UnmarshalPublicAddressRange unmarshals an instance of PublicAddressRange from the specified map of raw messages. +func UnmarshalPublicAddressRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRange) + 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()) @@ -83831,11 +85780,6 @@ func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (e 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()) @@ -83846,42 +85790,42 @@ func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "ipv4_address_count", &obj.Ipv4AddressCount) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ipv4_address_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalPublicAddressRangeTarget) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PublicGatewayCollection : PublicGatewayCollection struct -type PublicGatewayCollection struct { +// PublicAddressRangeCollection : PublicAddressRangeCollection struct +type PublicAddressRangeCollection struct { // A link to the first page of resources. First *PageLink `json:"first" validate:"required"` @@ -83892,16 +85836,16 @@ type PublicGatewayCollection struct { // except the last page. Next *PageLink `json:"next,omitempty"` - // A page of public gateways. - PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + // A page of public address ranges. + PublicAddressRanges []PublicAddressRange `json:"public_address_ranges" 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) +// UnmarshalPublicAddressRangeCollection unmarshals an instance of PublicAddressRangeCollection from the specified map of raw messages. +func UnmarshalPublicAddressRangeCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangeCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) @@ -83917,9 +85861,9 @@ func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + err = core.UnmarshalModel(m, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRange) if err != nil { - err = core.SDKErrorf(err, "", "public_gateways-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "public_address_ranges-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) @@ -83932,7 +85876,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 *PublicAddressRangeCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -83946,36 +85890,440 @@ func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { return start, nil } -// PublicGatewayFloatingIP : The floating IP bound to this public gateway. -type PublicGatewayFloatingIP struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` +// PublicAddressRangePatch : PublicAddressRangePatch struct +type PublicAddressRangePatch struct { + // The name for this public address range. The name must not be used by another public address range in the region. + Name *string `json:"name,omitempty"` - // The CRN for this floating IP. + // The target to bind this public address range to. + // + // If the public address range is not currently bound to a target, both `target.vpc` and + // `target.zone` must be specified. + // + // Specify `null` to unbind the public address range from any existing target. + Target *PublicAddressRangeTargetPatch `json:"target,omitempty"` +} + +// UnmarshalPublicAddressRangePatch unmarshals an instance of PublicAddressRangePatch from the specified map of raw messages. +func UnmarshalPublicAddressRangePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangePatch) + 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, UnmarshalPublicAddressRangeTargetPatch) + 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 PublicAddressRangePatch +func (publicAddressRangePatch *PublicAddressRangePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(publicAddressRangePatch.Name) { + _patch["name"] = publicAddressRangePatch.Name + } + if !core.IsNil(publicAddressRangePatch.Target) { + _patch["target"] = publicAddressRangePatch.Target.asPatch() + } + + return +} + +// PublicAddressRangeReference : PublicAddressRangeReference struct +type PublicAddressRangeReference struct { + // The CRN for this public address range. 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 floating IP. + // The URL for this public address range. Href *string `json:"href" validate:"required"` - // The unique identifier for this floating IP. + // The unique identifier for this public address range. ID *string `json:"id" validate:"required"` - // The name for this floating IP. The name is unique across all floating IPs in the region. + // The name for this public address range. The name is unique across all public address ranges in the region. Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" 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 - } +// Constants associated with the PublicAddressRangeReference.ResourceType property. +// The resource type. +const ( + PublicAddressRangeReferenceResourceTypePublicAddressRangeConst = "public_address_range" +) + +// UnmarshalPublicAddressRangeReference unmarshals an instance of PublicAddressRangeReference from the specified map of raw messages. +func UnmarshalPublicAddressRangeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangeReference) + 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 +} + +// PublicAddressRangeTarget : The target this public address range is bound to. +// +// If absent, this pubic address range is not bound to a target. +// +// The target resources supported by this property is expected to +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future targets may omit the `vpc` +// property. +type PublicAddressRangeTarget struct { + // The VPC this public address range is bound to. + VPC *VPCReference `json:"vpc,omitempty"` + + // The zone this public address range resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalPublicAddressRangeTarget unmarshals an instance of PublicAddressRangeTarget from the specified map of raw messages. +func UnmarshalPublicAddressRangeTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangeTarget) + 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 +} + +// PublicAddressRangeTargetPatch : The target to bind this public address range to. +// +// If the public address range is not currently bound to a target, both `target.vpc` and +// `target.zone` must be specified. +// +// Specify `null` to unbind the public address range from any existing target. +type PublicAddressRangeTargetPatch struct { + // The VPC to bind this public address range to, replacing any existing VPC. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The zone this public address range will reside in, replacing any existing zone. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// UnmarshalPublicAddressRangeTargetPatch unmarshals an instance of PublicAddressRangeTargetPatch from the specified map of raw messages. +func UnmarshalPublicAddressRangeTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangeTargetPatch) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the PublicAddressRangeTargetPatch +func (publicAddressRangeTargetPatch *PublicAddressRangeTargetPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(publicAddressRangeTargetPatch.VPC) { + _patch["vpc"] = publicAddressRangeTargetPatch.VPC.asPatch() + } + if !core.IsNil(publicAddressRangeTargetPatch.Zone) { + _patch["zone"] = publicAddressRangeTargetPatch.Zone.asPatch() + } + + return +} + +// PublicAddressRangeTargetPrototype : The target to bind this public address range to. If unspecified, the public address range will not be bound to a +// target at creation. +type PublicAddressRangeTargetPrototype struct { + // The VPC to bind this public address range to. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The zone this public address range will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewPublicAddressRangeTargetPrototype : Instantiate PublicAddressRangeTargetPrototype (Generic Model Constructor) +func (*VpcV1) NewPublicAddressRangeTargetPrototype(vpc VPCIdentityIntf, zone ZoneIdentityIntf) (_model *PublicAddressRangeTargetPrototype, err error) { + _model = &PublicAddressRangeTargetPrototype{ + VPC: vpc, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalPublicAddressRangeTargetPrototype unmarshals an instance of PublicAddressRangeTargetPrototype from the specified map of raw messages. +func UnmarshalPublicAddressRangeTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicAddressRangeTargetPrototype) + 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 + } + 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 *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 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, 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, "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 +} + +// 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 *Deleted `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()) @@ -84716,9 +87064,12 @@ type ReplaceBareMetalServerInitializationOptions struct { // 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. + // The default trusted profile to be used when initializing the bare metal server. // - // If unspecified, no user data will be made available. + // If unspecified, no default trusted profile will be made available. + DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The user data to be made available when initializing the bare metal server. UserData *string `json:"user_data,omitempty"` // Allows users to set headers on API requests. @@ -84752,6 +87103,12 @@ func (_options *ReplaceBareMetalServerInitializationOptions) SetKeys(keys []KeyI return _options } +// SetDefaultTrustedProfile : Allow user to set DefaultTrustedProfile +func (_options *ReplaceBareMetalServerInitializationOptions) SetDefaultTrustedProfile(defaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype) *ReplaceBareMetalServerInitializationOptions { + _options.DefaultTrustedProfile = defaultTrustedProfile + return _options +} + // SetUserData : Allow user to set UserData func (_options *ReplaceBareMetalServerInitializationOptions) SetUserData(userData string) *ReplaceBareMetalServerInitializationOptions { _options.UserData = core.StringPtr(userData) @@ -85837,7 +88194,7 @@ type ReservationStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -88412,7 +90769,7 @@ type SecurityGroupRule struct { // to all local IP addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - // The name of the network protocol to allow. + // The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -88454,7 +90811,7 @@ const ( ) // Constants associated with the SecurityGroupRule.Protocol property. -// The name of the network protocol to allow. +// The network protocol. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -88852,7 +91209,7 @@ type SecurityGroupRulePrototype struct { // addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - // The name of the network protocol to allow. + // 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 @@ -88904,7 +91261,7 @@ const ( ) // Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The name of the network protocol to allow. +// The network protocol. const ( SecurityGroupRulePrototypeProtocolAllConst = "all" SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" @@ -89511,6 +91868,9 @@ type Share struct { // The unique identifier for this file share. ID *string `json:"id" validate:"required"` + // The owner assigned to the file share at creation. + InitialOwner *ShareInitialOwner `json:"initial_owner" validate:"required"` + // The maximum [input/output operations per second (IOPS) // ](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for the file share. // @@ -89605,7 +91965,7 @@ type Share struct { // This property will be present when the `replication_role` is `replica`. SourceShare *ShareReference `json:"source_share,omitempty"` - // The snapshot this share was created from. + // The snapshot this file share was cloned from. // // This property will be present when the share was created from a snapshot. // @@ -89623,10 +91983,12 @@ type Share struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. StorageGeneration *int64 `json:"storage_generation" validate:"required"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags" validate:"required"` // The zone this file share resides in. + // + // This property will be absent for shares with an `availability_mode` of `regional`. Zone *ZoneReference `json:"zone,omitempty"` } @@ -89813,6 +92175,11 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "id-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()) @@ -90433,7 +92800,7 @@ type ShareJobStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -90510,8 +92877,11 @@ func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) // 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 + // - `cloning_failed`: The file share could not be cloned from the snapshot + // (contact IBM support) + // - `cloning_in_progress`: The file share is currently being cloned from the snapshot // - `internal_error`: internal error (contact IBM support) + // - `origin_share_access_revoked`: The resource has been revoked by the share owner // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM // support) // @@ -90522,20 +92892,25 @@ type ShareLifecycleReason struct { // 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. + // A 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 +// - `cloning_failed`: The file share could not be cloned from the snapshot +// (contact IBM support) +// - `cloning_in_progress`: The file share is currently being cloned from the snapshot // - `internal_error`: internal error (contact IBM support) +// - `origin_share_access_revoked`: The resource has been revoked by the share owner // - `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 ( + ShareLifecycleReasonCodeCloningFailedConst = "cloning_failed" + ShareLifecycleReasonCodeCloningInProgressConst = "cloning_in_progress" ShareLifecycleReasonCodeInternalErrorConst = "internal_error" ShareLifecycleReasonCodeOriginShareAccessRevokedConst = "origin_share_access_revoked" ShareLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" @@ -91055,9 +93430,9 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // `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. + // The 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. // @@ -91230,6 +93605,8 @@ type SharePatch struct { // // If the share has existing mount targets, the set of allowed access protocols must contain all `access_protocol` // modes specified by existing mount targets. + // + // For this property to be updated, the `accessor_binding_role` must be `none`. AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` // The transit encryption modes to allow for this share @@ -91241,7 +93618,8 @@ type SharePatch struct { // The maximum bandwidth (in megabits per second) for the share. // - // If specified, the share profile must not have a `bandwidth.type` of `dependent` or + // For this property to be changed, the share `accessor_binding_role` must not be + // `accessor`, the share profile must not have a `bandwidth.type` of `dependent` or // `fixed`, and the specified value must be within the `bandwidth` range of the share's profile. Bandwidth *int64 `json:"bandwidth,omitempty"` @@ -91258,7 +93636,19 @@ type SharePatch struct { // The profile to use for this file share. // - // The requested profile must be in the same `family`. + // The requested profile must be in the same `family`, with the following exceptions: + // - If the current profile family is `tiered`, the requested profile family may be + // `custom` or `defined_performance`. + // - If the current profile family is `custom`, the requested profile family may be + // `tiered` or `defined_performance`. Additionally, if requested profile family is + // `tiered`, then `iops` will be reset to a value based on the specified profile and + // current share size, and will become immutable. + // - If the current profile family is `defined_performance`, the requested profile + // family may be `tiered` or `custom`. Additionally, if requested profile family is + // `tiered`, then `iops` will be reset to a value based on the specified profile and + // current share size, and will become immutable. + // For this property to be changed, the share `accessor_binding_role` must not be + // `accessor`. Profile ShareProfileIdentityIntf `json:"profile,omitempty"` // The cron specification for the file share replication schedule. @@ -91277,7 +93667,7 @@ type SharePatch struct { // - The share `accessor_binding_role` must not be `accessor`. Size *int64 `json:"size,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` } @@ -91435,6 +93825,9 @@ type ShareProfile struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The storage generation for a share with this profile. + StorageGeneration ShareProfileStorageGenerationIntf `json:"storage_generation" validate:"required"` } // Constants associated with the ShareProfile.Family property. @@ -91443,7 +93836,9 @@ type ShareProfile struct { // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( + ShareProfileFamilyCustomConst = "custom" ShareProfileFamilyDefinedPerformanceConst = "defined_performance" + ShareProfileFamilyTieredConst = "tiered" ) // Constants associated with the ShareProfile.ResourceType property. @@ -91505,6 +93900,11 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "storage_generation", &obj.StorageGeneration, UnmarshalShareProfileStorageGeneration) + if err != nil { + err = core.SDKErrorf(err, "", "storage_generation-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -92142,6 +94542,48 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa return } +// ShareProfileStorageGeneration : ShareProfileStorageGeneration struct +// Models which "extend" this model: +// - ShareProfileStorageGenerationFixed +type ShareProfileStorageGeneration 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 ShareProfileStorageGeneration.Type property. +// The type for this profile field. +const ( + ShareProfileStorageGenerationTypeFixedConst = "fixed" +) + +func (*ShareProfileStorageGeneration) isaShareProfileStorageGeneration() bool { + return true +} + +type ShareProfileStorageGenerationIntf interface { + isaShareProfileStorageGeneration() bool +} + +// UnmarshalShareProfileStorageGeneration unmarshals an instance of ShareProfileStorageGeneration from the specified map of raw messages. +func UnmarshalShareProfileStorageGeneration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileStorageGeneration) + 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 +} + // SharePrototype : SharePrototype struct // Models which "extend" this model: // - SharePrototypeShareBySize @@ -92171,7 +94613,7 @@ type SharePrototype struct { // `zonal`. ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The access control mode for the share: @@ -92233,8 +94675,8 @@ type SharePrototype struct { // 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. // - // This property must not be specified if the `availability_mode` of the profile for the - // share is `regional`. + // This property must be specified if the share profile `availability_mode` is `zonal`, + // and must not be specified otherwise. Zone ZoneIdentityIntf `json:"zone,omitempty"` // The cron specification for the file share replication schedule. @@ -92245,9 +94687,12 @@ type SharePrototype struct { // [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 - // 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 + // The source file share for this replica file share. The specified file share must: + // - Not already have a replica. + // - Not be a replica. + // - Have a `storage_generation` of `1`. + // + // 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"` @@ -92258,7 +94703,7 @@ 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. + // The source snapshot to clone this file share from. // // 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` @@ -92432,7 +94877,9 @@ type SharePrototypeShareContext struct { 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. + // for this file share. The profile must: + // - support the share's specified IOPS and size, and + // - have the same `storage_generation` as the share. Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` // The cron specification for the file share replication schedule. @@ -92444,7 +94891,7 @@ type SharePrototypeShareContext struct { // the source share will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The zone this replica file share will reside in. For a replica share in the same @@ -92638,7 +95085,7 @@ type ShareReplicationStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -92968,7 +95415,7 @@ type ShareSnapshotLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -93009,6 +95456,11 @@ func UnmarshalShareSnapshotLifecycleReason(m map[string]json.RawMessage, result // ShareSnapshotPatch : ShareSnapshotPatch struct type ShareSnapshotPatch struct { + // The name for this share snapshot. The name must be unique among all snapshots for the file share. For this property + // to be changed, the share's `replication_role` must not be + // `replica`. + 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"` } @@ -93016,6 +95468,11 @@ type ShareSnapshotPatch struct { // 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, "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()) @@ -93028,6 +95485,9 @@ func UnmarshalShareSnapshotPatch(m map[string]json.RawMessage, result interface{ // 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.Name) { + _patch["name"] = shareSnapshotPatch.Name + } if !core.IsNil(shareSnapshotPatch.UserTags) { _patch["user_tags"] = shareSnapshotPatch.UserTags } @@ -93049,7 +95509,7 @@ type ShareSnapshotStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -93235,6 +95695,14 @@ func UnmarshalShareSourceSnapshotPrototype(m map[string]json.RawMessage, result // Snapshot : Snapshot struct type Snapshot struct { + // The usage constraints to be matched against the requested instance properties to + // determine compatibility. While bare metal servers cannot be provisioned from snapshots, + // an image or volume created from this snapshot will inherit its `allowed_use` value. + // + // Only present on bootable snapshots. The value of this property will be inherited from + // the source volume or source snapshot at snapshot creation, but can be changed. + AllowedUse *SnapshotAllowedUse `json:"allowed_use,omitempty"` + // If present, the backup policy plan which created this snapshot. BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` @@ -93255,7 +95723,7 @@ type Snapshot struct { // If absent, this snapshot is not associated with a catalog offering. CatalogOffering *SnapshotCatalogOffering `json:"catalog_offering,omitempty"` - // Clones for this snapshot. + // The clones for this snapshot. Clones []SnapshotClone `json:"clones" validate:"required"` // The copies of this snapshot. @@ -93372,6 +95840,11 @@ const ( // 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUse) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-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()) @@ -93516,6 +95989,181 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er return } +// SnapshotAllowedUse : SnapshotAllowedUse struct +type SnapshotAllowedUse struct { + // The API version with which to evaluate the expressions. + ApiVersion *string `json:"api_version" validate:"required"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this snapshot. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server" validate:"required"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this + // snapshot. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance" validate:"required"` +} + +// UnmarshalSnapshotAllowedUse unmarshals an instance of SnapshotAllowedUse from the specified map of raw messages. +func UnmarshalSnapshotAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotAllowedUse) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotAllowedUsePatch : SnapshotAllowedUsePatch struct +type SnapshotAllowedUsePatch struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this snapshot. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this + // snapshot. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalSnapshotAllowedUsePatch unmarshals an instance of SnapshotAllowedUsePatch from the specified map of raw messages. +func UnmarshalSnapshotAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotAllowedUsePatch) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the SnapshotAllowedUsePatch +func (snapshotAllowedUsePatch *SnapshotAllowedUsePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(snapshotAllowedUsePatch.ApiVersion) { + _patch["api_version"] = snapshotAllowedUsePatch.ApiVersion + } + if !core.IsNil(snapshotAllowedUsePatch.BareMetalServer) { + _patch["bare_metal_server"] = snapshotAllowedUsePatch.BareMetalServer + } + if !core.IsNil(snapshotAllowedUsePatch.Instance) { + _patch["instance"] = snapshotAllowedUsePatch.Instance + } + + return +} + +// SnapshotAllowedUsePrototype : SnapshotAllowedUsePrototype struct +type SnapshotAllowedUsePrototype struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query + // parameter value will be used. + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this snapshot. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this + // snapshot. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalSnapshotAllowedUsePrototype unmarshals an instance of SnapshotAllowedUsePrototype from the specified map of raw messages. +func UnmarshalSnapshotAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotAllowedUsePrototype) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotCatalogOffering : SnapshotCatalogOffering struct type SnapshotCatalogOffering struct { // The billing plan associated with the catalog offering version. @@ -93946,8 +96594,9 @@ type SnapshotConsistencyGroupPrototype struct { // 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. + // The data-consistent member snapshots to create. Each snapshot must specify a + // `source_volume` attached to the same virtual server instance, and all source volumes must have a + // `storage_generation` value of `1`. Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots,omitempty"` } @@ -94172,8 +96821,81 @@ func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) return } +// SnapshotInstanceProfileCollection : SnapshotInstanceProfileCollection struct +type SnapshotInstanceProfileCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // A page of instance profiles compatible with the snapshot. + InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `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"` +} + +// UnmarshalSnapshotInstanceProfileCollection unmarshals an instance of SnapshotInstanceProfileCollection from the specified map of raw messages. +func UnmarshalSnapshotInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotInstanceProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "instance_profiles-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 *SnapshotInstanceProfileCollection) 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 +} + // SnapshotPatch : SnapshotPatch struct type SnapshotPatch struct { + // The usage constraints to be matched against the requested instance properties to + // determine compatibility. While bare metal servers cannot be provisioned from snapshots, + // an image or volume created from this snapshot will inherit its `allowed_use` value. + // + // Can only be specified for bootable snapshots. + AllowedUse *SnapshotAllowedUsePatch `json:"allowed_use,omitempty"` + // The name for this snapshot. The name must not be used by another snapshot in the region. Name *string `json:"name,omitempty"` @@ -94184,6 +96906,11 @@ type SnapshotPatch struct { // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePatch) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -94201,6 +96928,9 @@ 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) { _patch = map[string]interface{}{} + if !core.IsNil(snapshotPatch.AllowedUse) { + _patch["allowed_use"] = snapshotPatch.AllowedUse.asPatch() + } if !core.IsNil(snapshotPatch.Name) { _patch["name"] = snapshotPatch.Name } @@ -94216,7 +96946,13 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er // - SnapshotPrototypeSnapshotBySourceVolume // - SnapshotPrototypeSnapshotBySourceSnapshot type SnapshotPrototype struct { - // Clones to create for this snapshot. + // The usage constraints to match against the requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified for bootable snapshots. + AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` + + // The 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 @@ -94260,6 +96996,11 @@ 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) @@ -97457,6 +100198,44 @@ func (options *UpdatePrivatePathServiceGatewayOptions) SetHeaders(param map[stri return options } +// UpdatePublicAddressRangeOptions : The UpdatePublicAddressRange options. +type UpdatePublicAddressRangeOptions struct { + // The public address range identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public address range patch. + PublicAddressRangePatch map[string]interface{} `json:"PublicAddressRange_patch" validate:"required"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdatePublicAddressRangeOptions : Instantiate UpdatePublicAddressRangeOptions +func (*VpcV1) NewUpdatePublicAddressRangeOptions(id string, publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions { + return &UpdatePublicAddressRangeOptions{ + ID: core.StringPtr(id), + PublicAddressRangePatch: publicAddressRangePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePublicAddressRangeOptions) SetID(id string) *UpdatePublicAddressRangeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicAddressRangePatch : Allow user to set PublicAddressRangePatch +func (_options *UpdatePublicAddressRangeOptions) SetPublicAddressRangePatch(publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions { + _options.PublicAddressRangePatch = publicAddressRangePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePublicAddressRangeOptions) SetHeaders(param map[string]string) *UpdatePublicAddressRangeOptions { + options.Headers = param + return options +} + // UpdatePublicGatewayOptions : The UpdatePublicGateway options. type UpdatePublicGatewayOptions struct { // The public gateway identifier. @@ -98775,8 +101554,7 @@ func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) // 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. + // network connectivity to the account's Classic Infrastructure resources. ClassicAccess *bool `json:"classic_access" validate:"required"` // The date and time that the VPC was created. @@ -98827,6 +101605,9 @@ type VPC struct { // The name for this VPC. The name is unique across all VPCs in the region. Name *string `json:"name" validate:"required"` + // The public address ranges attached to this VPC. + PublicAddressRanges []PublicAddressRangeReference `json:"public_address_ranges" validate:"required"` + // The resource group for this VPC. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -98941,6 +101722,11 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRangeReference) + if err != nil { + err = core.SDKErrorf(err, "", "public_address_ranges-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()) @@ -99365,7 +102151,7 @@ type VpcdnsResolutionBindingHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -99822,7 +102608,7 @@ type VPCHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -99877,6 +102663,7 @@ func (*VPCIdentity) isaVPCIdentity() bool { type VPCIdentityIntf interface { isaVPCIdentity() bool + asPatch() map[string]interface{} } // UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. @@ -99901,6 +102688,22 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err return } +// asPatch returns a generic map representation of the VPCIdentity +func (vpcIdentity *VPCIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcIdentity.ID) { + _patch["id"] = vpcIdentity.ID + } + if !core.IsNil(vpcIdentity.CRN) { + _patch["crn"] = vpcIdentity.CRN + } + if !core.IsNil(vpcIdentity.Href) { + _patch["href"] = vpcIdentity.Href + } + + return +} + // VPCPatch : VPCPatch struct type VPCPatch struct { // The DNS configuration for this VPC. @@ -100180,7 +102983,7 @@ func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err e // - VPNGatewayPolicyMode // - VPNGatewayRouteMode type VPNGateway struct { - // Connections for this VPN gateway. + // The connections for this VPN gateway. Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` // The date and time that this VPN gateway was created. @@ -100230,7 +103033,7 @@ type VPNGateway struct { // The VPC this VPN gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` - // Policy mode VPN gateway. + // The mode for this VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -100268,7 +103071,7 @@ const ( ) // Constants associated with the VPNGateway.Mode property. -// Policy mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayModePolicyConst = "policy" ) @@ -100451,7 +103254,7 @@ type VPNGatewayConnection struct { // The date and time that this VPN gateway connection was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The Dead Peer Detection settings. + // The dead peer detection configuration. DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` // The establish mode of the VPN gateway connection: @@ -100507,7 +103310,7 @@ type VPNGatewayConnection struct { Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` - // Routing protocols are disabled for this VPN gateway connection. + // The routing protocol for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` // The VPN tunnel configuration for this VPN gateway connection (in static route mode). @@ -100560,7 +103363,7 @@ const ( ) // Constants associated with the VPNGatewayConnection.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// The routing protocol for this VPN gateway connection. const ( VPNGatewayConnectionRoutingProtocolNoneConst = "none" ) @@ -100688,20 +103491,20 @@ func (resp *VPNGatewayConnectionCollection) GetNextStart() (*string, error) { return start, nil } -// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +// VPNGatewayConnectionDpd : The dead peer detection configuration. type VPNGatewayConnectionDpd struct { - // Dead Peer Detection actions. + // The dead peer detection action. Action *string `json:"action" validate:"required"` - // Dead Peer Detection interval in seconds. + // The dead peer detection interval in seconds. Must not be greater than `timeout`. Interval *int64 `json:"interval" validate:"required"` - // Dead Peer Detection timeout in seconds. Must be at least the interval. + // The dead peer detection timeout in seconds. Must not be less than `interval`. Timeout *int64 `json:"timeout" validate:"required"` } // Constants associated with the VPNGatewayConnectionDpd.Action property. -// Dead Peer Detection actions. +// The dead peer detection action. const ( VPNGatewayConnectionDpdActionClearConst = "clear" VPNGatewayConnectionDpdActionHoldConst = "hold" @@ -100731,20 +103534,20 @@ func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result inter return } -// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. +// VPNGatewayConnectionDpdPatch : The dead peer detection configuration. type VPNGatewayConnectionDpdPatch struct { - // Dead Peer Detection actions. + // The dead peer detection action. Action *string `json:"action,omitempty"` - // Dead Peer Detection interval in seconds. + // The dead peer detection interval in seconds. Must not be greater than `timeout`. Interval *int64 `json:"interval,omitempty"` - // Dead Peer Detection timeout in seconds. Must be at least the interval. + // The dead peer detection timeout in seconds. Must not be less than `interval`. Timeout *int64 `json:"timeout,omitempty"` } // Constants associated with the VPNGatewayConnectionDpdPatch.Action property. -// Dead Peer Detection actions. +// The dead peer detection action. const ( VPNGatewayConnectionDpdPatchActionClearConst = "clear" VPNGatewayConnectionDpdPatchActionHoldConst = "hold" @@ -100790,20 +103593,20 @@ func (vpnGatewayConnectionDpdPatch *VPNGatewayConnectionDpdPatch) asPatch() (_pa return } -// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +// VPNGatewayConnectionDpdPrototype : The dead peer detection configuration. type VPNGatewayConnectionDpdPrototype struct { - // Dead Peer Detection actions. + // The dead peer detection action. Action *string `json:"action,omitempty"` - // Dead Peer Detection interval in seconds. + // The dead peer detection interval in seconds. Must not be greater than `timeout`. Interval *int64 `json:"interval,omitempty"` - // Dead Peer Detection timeout in seconds. Must be at least the interval. + // The dead peer detection timeout in seconds. Must not be less than `interval`. Timeout *int64 `json:"timeout,omitempty"` } // Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. -// Dead Peer Detection actions. +// The dead peer detection action. const ( VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" @@ -101120,7 +103923,7 @@ 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. + // The dead peer detection configuration. 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 @@ -101515,7 +104318,7 @@ 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. + // The dead peer detection configuration. DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` // The establish mode of the VPN gateway connection: @@ -101553,7 +104356,7 @@ type VPNGatewayConnectionPrototype struct { Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"` - // Routing protocols are disabled for this VPN gateway connection. + // The routing protocol for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` } @@ -101571,7 +104374,7 @@ const ( ) // Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// The routing protocol for this VPN gateway connection. const ( VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" ) @@ -101917,7 +104720,7 @@ type VPNGatewayConnectionStatusReason struct { // 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. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -101983,7 +104786,7 @@ type VPNGatewayConnectionTunnelStatusReason struct { // 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. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -102053,7 +104856,7 @@ type VPNGatewayHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -102108,7 +104911,7 @@ type VPNGatewayLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -102275,7 +105078,7 @@ type VPNGatewayMemberHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -102328,7 +105131,7 @@ type VPNGatewayMemberLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -102411,12 +105214,12 @@ type VPNGatewayPrototype struct { // Identifies a subnet by a unique property. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Route mode VPN gateway. + // The mode for this VPN gateway. Mode *string `json:"mode,omitempty"` } // Constants associated with the VPNGatewayPrototype.Mode property. -// Route mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayPrototypeModeRouteConst = "route" ) @@ -102505,7 +105308,7 @@ type VPNServer struct { // 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. + // The fully qualified domain name assigned to this VPN server. Hostname *string `json:"hostname" validate:"required"` // The URL for this VPN server. @@ -103214,7 +106017,7 @@ type VPNServerHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -103277,7 +106080,7 @@ type VPNServerLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -103713,7 +106516,7 @@ type VPNServerRouteHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -103763,7 +106566,7 @@ type VPNServerRouteLifecycleReason struct { // 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. + // A link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } @@ -104515,6 +107318,12 @@ type Volume struct { // The attachment states that support adjustable IOPS for this volume. AdjustableIopsStates []string `json:"adjustable_iops_states" validate:"required"` + // The usage constraints to be matched against the requested instance or bare metal server + // properties to determine compatibility. + // + // Only present for boot volumes. + AllowedUse *VolumeAllowedUse `json:"allowed_use,omitempty"` + // 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) @@ -104731,6 +107540,11 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro err = core.SDKErrorf(err, "", "adjustable_iops_states-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUse) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) if err != nil { err = core.SDKErrorf(err, "", "attachment_state-error", common.GetComponentInfo()) @@ -104870,6 +107684,178 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro return } +// VolumeAllowedUse : VolumeAllowedUse struct +type VolumeAllowedUse struct { + // The API version with which to evaluate the expressions. + ApiVersion *string `json:"api_version" validate:"required"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this volume. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server" validate:"required"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance" validate:"required"` +} + +// UnmarshalVolumeAllowedUse unmarshals an instance of VolumeAllowedUse from the specified map of raw messages. +func UnmarshalVolumeAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAllowedUse) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAllowedUsePatch : VolumeAllowedUsePatch struct +type VolumeAllowedUsePatch struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this volume. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalVolumeAllowedUsePatch unmarshals an instance of VolumeAllowedUsePatch from the specified map of raw messages. +func UnmarshalVolumeAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAllowedUsePatch) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the VolumeAllowedUsePatch +func (volumeAllowedUsePatch *VolumeAllowedUsePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(volumeAllowedUsePatch.ApiVersion) { + _patch["api_version"] = volumeAllowedUsePatch.ApiVersion + } + if !core.IsNil(volumeAllowedUsePatch.BareMetalServer) { + _patch["bare_metal_server"] = volumeAllowedUsePatch.BareMetalServer + } + if !core.IsNil(volumeAllowedUsePatch.Instance) { + _patch["instance"] = volumeAllowedUsePatch.Instance + } + + return +} + +// VolumeAllowedUsePrototype : VolumeAllowedUsePrototype struct +type VolumeAllowedUsePrototype struct { + // The API version with which to evaluate the expressions. + // + // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query + // parameter value will be used. + ApiVersion *string `json:"api_version,omitempty"` + + // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in + // this volume. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding + // to the `BareMetalServer` property: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. + BareMetalServer *string `json:"bare_metal_server,omitempty"` + + // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume. + // + // If unspecified, the expression will be set to `true`. + // + // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), + // but does not support built-in functions and macros. In addition, the following variables are supported, + // corresponding to `Instance` properties: + // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled + // - `gpu.count` (integer): The number of GPUs + // - `gpu.manufacturer` (string): The GPU manufacturer + // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) + // - `gpu.model` (string): The GPU model. + Instance *string `json:"instance,omitempty"` +} + +// UnmarshalVolumeAllowedUsePrototype unmarshals an instance of VolumeAllowedUsePrototype from the specified map of raw messages. +func UnmarshalVolumeAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAllowedUsePrototype) + err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) + if err != nil { + err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + err = core.SDKErrorf(err, "", "instance-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 @@ -104882,7 +107868,7 @@ type VolumeAttachment struct { // 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. + // The configuration for the volume as a device in the instance operating system. // // This property may be absent if the volume attachment's `status` is not `attached`. Device *VolumeAttachmentDevice `json:"device,omitempty"` @@ -105314,6 +108300,13 @@ type VolumeAttachmentPrototypeVolume struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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. @@ -105389,6 +108382,11 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-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()) @@ -105404,7 +108402,7 @@ type VolumeAttachmentReferenceInstanceContext struct { // some supplementary information. Deleted *Deleted `json:"deleted,omitempty"` - // Information about how the volume is exposed to the instance operating system. + // The configuration for the volume as a device in the instance operating system. // // This property may be absent if the volume attachment's `status` is not `attached`. Device *VolumeAttachmentDevice `json:"device,omitempty"` @@ -105470,7 +108468,7 @@ type VolumeAttachmentReferenceVolumeContext struct { // some supplementary information. Deleted *Deleted `json:"deleted,omitempty"` - // Information about how the volume is exposed to the instance operating system. + // The configuration for the volume as a device in the instance operating system. // // This property may be absent if the volume attachment's `status` is not `attached`. Device *VolumeAttachmentDevice `json:"device,omitempty"` @@ -105655,7 +108653,7 @@ type VolumeHealthReason struct { // 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. + // A link to documentation about the reason for this health state. MoreInfo *string `json:"more_info,omitempty"` } @@ -105734,8 +108732,80 @@ func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) ( return } +// VolumeInstanceProfileCollection : VolumeInstanceProfileCollection struct +type VolumeInstanceProfileCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // A page of instance profiles compatible with the volume. + InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `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"` +} + +// UnmarshalVolumeInstanceProfileCollection unmarshals an instance of VolumeInstanceProfileCollection from the specified map of raw messages. +func UnmarshalVolumeInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeInstanceProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "instance_profiles-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 *VolumeInstanceProfileCollection) 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 +} + // VolumePatch : VolumePatch struct type VolumePatch struct { + // The usage constraints to be matched against the requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified for boot volumes with an `attachment_state` of `unattached`. + AllowedUse *VolumeAllowedUsePatch `json:"allowed_use,omitempty"` + // The maximum bandwidth (in megabits per second) for the volume. // // If specified, the volume profile must not have a `bandwidth.type` of `dependent`. @@ -105778,6 +108848,11 @@ type VolumePatch struct { // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePatch) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) @@ -105815,6 +108890,9 @@ 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) { _patch = map[string]interface{}{} + if !core.IsNil(volumePatch.AllowedUse) { + _patch["allowed_use"] = volumePatch.AllowedUse.asPatch() + } if !core.IsNil(volumePatch.Bandwidth) { _patch["bandwidth"] = volumePatch.Bandwidth } @@ -106587,6 +109665,13 @@ type VolumePrototype struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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. @@ -106652,6 +109737,11 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-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()) @@ -106663,6 +109753,13 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) // VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct type VolumePrototypeInstanceByImageContext struct { + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_image`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // The maximum bandwidth (in megabits per second) for the volume. // // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be @@ -106724,6 +109821,11 @@ func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIden // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) @@ -106770,6 +109872,13 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage // VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct type VolumePrototypeInstanceBySourceSnapshotContext struct { + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // The maximum bandwidth (in megabits per second) for the volume. // // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be @@ -106837,6 +109946,11 @@ func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumePr // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) @@ -107056,7 +110170,7 @@ type VolumeStatusReason struct { // An explanation of the status reason. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // A link to documentation about this status reason. MoreInfo *string `json:"more_info,omitempty"` } @@ -108138,6 +111252,9 @@ type BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype 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. + // + // A backup policy of type `instance` will create a backup of all volumes with a + // `storage_generation` value of `1` attached to the instance. MatchResourceType *string `json:"match_resource_type" validate:"required"` } @@ -108151,6 +111268,9 @@ const ( // 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. +// +// A backup policy of type `instance` will create a backup of all volumes with a +// `storage_generation` value of `1` attached to the instance. const ( BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeMatchResourceTypeInstanceConst = "instance" ) @@ -108712,7 +111832,7 @@ func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string // BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct // This model "extends" BareMetalServerInitializationUserAccount type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + // 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 password. @@ -108805,11 +111925,6 @@ type BareMetalServerNetworkAttachmentByPci struct { // 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"` } @@ -108842,11 +111957,6 @@ const ( ) // 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" ) @@ -108980,9 +112090,6 @@ type BareMetalServerNetworkAttachmentByVlan struct { // 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. @@ -109018,9 +112125,6 @@ const ( ) // 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" ) @@ -109181,9 +112285,9 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetw // `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. + // The 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. // @@ -109325,22 +112429,10 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // 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" ) @@ -109411,9 +112503,6 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy // 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. @@ -109421,9 +112510,6 @@ type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentBy } // 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" ) @@ -109592,8 +112678,6 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // 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"` } @@ -109629,8 +112713,6 @@ const ( ) // 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" ) @@ -109848,11 +112930,6 @@ type BareMetalServerNetworkInterfaceByPci struct { // `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"` } @@ -109888,11 +112965,6 @@ const ( ) // 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" ) @@ -110124,11 +113196,6 @@ type BareMetalServerNetworkInterfaceByVlan struct { // 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. @@ -110172,11 +113239,6 @@ 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. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. const ( BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" ) @@ -110328,16 +113390,10 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // 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" ) @@ -110450,22 +113506,10 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // 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" ) @@ -110597,12 +113641,6 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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. @@ -110615,12 +113653,6 @@ 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`. -// - 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" ) @@ -110707,22 +113739,10 @@ type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetwo // 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" ) @@ -112043,6 +115063,8 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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. // @@ -112112,6 +115134,11 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) + 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()) @@ -112175,6 +115202,8 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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. // @@ -112244,6 +115273,11 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) + 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()) @@ -115977,6 +119011,10 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} // ImagePrototypeImageByFile : ImagePrototypeImageByFile struct // This model "extends" ImagePrototype type ImagePrototypeImageByFile struct { + // The usage constraints to match against the requested instance or bare metal server properties to determine + // compatibility. + AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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` @@ -116053,6 +119091,11 @@ 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) @@ -116100,6 +119143,10 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int // ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct // This model "extends" ImagePrototype type ImagePrototypeImageBySourceVolume struct { + // The usage constraints to match against the requested instance or bare metal server properties to determine + // compatibility. + AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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` @@ -116163,6 +119210,11 @@ 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) @@ -117451,9 +120503,9 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInte // `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. + // The 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. // @@ -119800,6 +122852,80 @@ func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result inte return } +// InstanceProfileVcpuManufacturerDependent : The VCPU Manufacturer for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileVcpuManufacturer +type InstanceProfileVcpuManufacturerDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuManufacturerDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuManufacturerDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVcpuManufacturerDependent) isaInstanceProfileVcpuManufacturer() bool { + return true +} + +// UnmarshalInstanceProfileVcpuManufacturerDependent unmarshals an instance of InstanceProfileVcpuManufacturerDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuManufacturerDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuManufacturerDependent) + 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 +} + +// InstanceProfileVcpuManufacturerFixed : InstanceProfileVcpuManufacturerFixed struct +// This model "extends" InstanceProfileVcpuManufacturer +type InstanceProfileVcpuManufacturerFixed struct { + // 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 InstanceProfileVcpuManufacturerFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuManufacturerFixedTypeFixedConst = "fixed" +) + +// Constants associated with the InstanceProfileVcpuManufacturerFixed.Value property. +// The VCPU manufacturer for an instance with this profile. +const ( + InstanceProfileVcpuManufacturerFixedValueAmdConst = "amd" + InstanceProfileVcpuManufacturerFixedValueIBMConst = "ibm" + InstanceProfileVcpuManufacturerFixedValueIntelConst = "intel" +) + +func (*InstanceProfileVcpuManufacturerFixed) isaInstanceProfileVcpuManufacturer() bool { + return true +} + +// UnmarshalInstanceProfileVcpuManufacturerFixed unmarshals an instance of InstanceProfileVcpuManufacturerFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuManufacturerFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuManufacturerFixed) + 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 { @@ -120042,7 +123168,6 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -120089,9 +123214,6 @@ type InstancePrototypeInstanceByCatalogOffering struct { // 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. @@ -120108,8 +123230,8 @@ type InstancePrototypeInstanceByCatalogOffering struct { // `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. + // The [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. @@ -120302,7 +123424,6 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -120349,9 +123470,6 @@ type InstancePrototypeInstanceByImage struct { // 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. @@ -120368,8 +123486,8 @@ type InstancePrototypeInstanceByImage struct { // `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. + // The [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. @@ -120554,7 +123672,6 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -120601,9 +123718,6 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // 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. @@ -120620,8 +123734,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // `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. + // The [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. @@ -120801,7 +123915,6 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes // `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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -120848,9 +123961,6 @@ type InstancePrototypeInstanceBySourceTemplate struct { // 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. @@ -120867,8 +123977,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // `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. + // The [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. @@ -121080,7 +124190,6 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -121127,9 +124236,6 @@ type InstancePrototypeInstanceByVolume struct { // 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. @@ -121146,8 +124252,8 @@ type InstancePrototypeInstanceByVolume struct { // `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. + // The [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. @@ -121459,7 +124565,6 @@ func (instanceTemplateIdentityByID *InstanceTemplateIdentityByID) asPatch() (_pa // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -121504,9 +124609,6 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // 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. @@ -121523,8 +124625,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // `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. + // The [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. @@ -121717,7 +124819,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -121762,9 +124863,6 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // 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. @@ -121781,8 +124879,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // `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. + // The [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. @@ -121967,7 +125065,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -122012,9 +125109,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // 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. @@ -122031,8 +125125,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // `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. + // The [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. @@ -122212,7 +125306,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st // `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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -122257,9 +125350,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // 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. @@ -122276,8 +125366,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // `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. + // The [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. @@ -122489,7 +125579,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -122545,9 +125634,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 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. @@ -122565,8 +125651,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // `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. + // The [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. @@ -122777,7 +125863,6 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -122833,9 +125918,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 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. @@ -122853,8 +125935,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // `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. + // The [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. @@ -123059,7 +126141,6 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin // - 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -123115,9 +126196,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 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. @@ -123135,8 +126213,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // `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. + // The [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. @@ -123365,8 +126443,11 @@ func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) // 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 + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as // `SHA256`). + // + // The length of this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Fingerprint *string `json:"fingerprint" validate:"required"` } @@ -126276,7 +129357,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 name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -126301,7 +129382,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" ) @@ -126411,7 +129492,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { // If absent, all codes are matched. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -126441,7 +129522,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -126522,7 +129603,7 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.Raw return } -// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : A rule for TCP or UDP traffic. // This model "extends" NetworkACLRuleItem type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { // The action to perform for a packet matching the rule. @@ -126562,7 +129643,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { // The inclusive lower bound of the TCP or UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of the TCP or UDP source port range. @@ -126593,7 +129674,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -126707,7 +129788,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 name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -126732,7 +129813,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" ) @@ -126826,7 +129907,7 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype // If specified, `type` must also be specified. If unspecified, all codes are matched. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -126856,7 +129937,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" ) @@ -126967,7 +130048,7 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototy // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of the TCP or UDP source port range. @@ -127004,7 +130085,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" @@ -127116,7 +130197,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 name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -127141,7 +130222,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" ) @@ -127242,7 +130323,7 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { // If specified, `type` must also be specified. If unspecified, all codes are matched. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -127272,7 +130353,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" ) @@ -127390,7 +130471,7 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of the TCP or UDP source port range. @@ -127427,7 +130508,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" @@ -127553,7 +130634,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 name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -127578,7 +130659,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" ) @@ -127687,7 +130768,7 @@ type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { // If absent, all codes are matched. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -127717,7 +130798,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -127798,7 +130879,7 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMess return } -// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : A rule for TCP or UDP traffic. // This model "extends" NetworkACLRule type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { // The action to perform for a packet matching the rule. @@ -127837,7 +130918,7 @@ type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { // The inclusive lower bound of the TCP or UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of the TCP or UDP source port range. @@ -127868,7 +130949,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -130193,7 +133274,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -130215,7 +133296,7 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" ) @@ -130291,7 +133372,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // If specified, `type` must also be specified. If unspecified, all codes are allowed. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to allow. @@ -130318,7 +133399,7 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -130411,7 +133492,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // unspecified, allowing traffic on all destination ports. PortMin *int64 `json:"port_min,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -130433,7 +133514,7 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -130921,7 +134002,7 @@ type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -130943,7 +134024,7 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" ) @@ -131020,7 +134101,7 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { // The ICMP traffic code to allow. If absent, all codes are allowed. Code *int64 `json:"code,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to allow. If absent, all types are allowed. @@ -131045,7 +134126,7 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -131138,7 +134219,7 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The inclusive lower bound of the TCP or UDP destination port range. PortMin *int64 `json:"port_min,omitempty"` - // The name of the network protocol. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -131160,7 +134241,7 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The name of the network protocol. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -132165,9 +135246,9 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // `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. + // The 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. // @@ -133264,13 +136345,49 @@ func (shareProfileIdentityByName *ShareProfileIdentityByName) asPatch() (_patch return } +// ShareProfileStorageGenerationFixed : The storage generation value of a share with this profile is fixed. +// This model "extends" ShareProfileStorageGeneration +type ShareProfileStorageGenerationFixed 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 ShareProfileStorageGenerationFixed.Type property. +// The type for this profile field. +const ( + ShareProfileStorageGenerationFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileStorageGenerationFixed) isaShareProfileStorageGeneration() bool { + return true +} + +// UnmarshalShareProfileStorageGenerationFixed unmarshals an instance of ShareProfileStorageGenerationFixed from the specified map of raw messages. +func UnmarshalShareProfileStorageGenerationFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileStorageGenerationFixed) + 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 +} + // SharePrototypeShareByOriginShare : Create an accessor file share for an existing file share. The values for // `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, // `initial_owner`, `iops`, `profile`, `size`, and `zone` will be inherited from // `origin_share`. // -// Accessor file shares can only be created for shares with an `availability_mode` of -// `zonal`. +// Accessor file shares can only be created for shares with a `storage_generation` of `1`. // This model "extends" SharePrototype type SharePrototypeShareByOriginShare struct { // The transit encryption modes to allow for this share. If unspecified: @@ -133289,7 +136406,7 @@ type SharePrototypeShareByOriginShare struct { ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The origin share for the accessor share. The origin share must have an @@ -133298,6 +136415,10 @@ type SharePrototypeShareByOriginShare struct { // // The specified share may be in a different account, subject to IAM policies. OriginShare ShareIdentityIntf `json:"origin_share" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the origin share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } // Constants associated with the SharePrototypeShareByOriginShare.AllowedTransitEncryptionModes property. @@ -133356,6 +136477,11 @@ func UnmarshalSharePrototypeShareByOriginShare(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "origin_share-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 } @@ -133379,7 +136505,7 @@ type SharePrototypeShareBySize struct { ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The access control mode for the share: @@ -133441,8 +136567,8 @@ type SharePrototypeShareBySize struct { // 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. // - // This property must not be specified if the `availability_mode` of the profile for the - // share is `regional`. + // This property must be specified if the share profile `availability_mode` is `zonal`, + // and must not be specified otherwise. Zone ZoneIdentityIntf `json:"zone,omitempty"` } @@ -133574,8 +136700,8 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int // `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, // `initial_owner`, and `size` will be inherited from the `source_share`. // -// Replica file shares can only be created for shares with an `availability_mode` of -// `zonal`. +// Replica file shares can only be created if the source share has a `storage_generation` of +// `1`. // This model "extends" SharePrototype type SharePrototypeShareBySourceShare struct { // The transit encryption modes to allow for this share. If unspecified: @@ -133594,7 +136720,7 @@ type SharePrototypeShareBySourceShare struct { ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The root key to use to wrap the data encryption key for the share. @@ -133612,7 +136738,9 @@ type SharePrototypeShareBySourceShare struct { 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. + // for this file share. The profile must: + // - support the share's specified IOPS and size, and + // - have the same `storage_generation` as the source share. Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` // The cron specification for the file share replication schedule. @@ -133627,17 +136755,20 @@ type SharePrototypeShareBySourceShare struct { // 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 + // The source file share for this replica file share. The specified file share must: + // - Not already have a replica. + // - Not be a replica. + // - Have a `storage_generation` of `1`. + // + // 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"` // 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. // - // This property must not be specified if the `availability_mode` of the profile for the - // share is `regional`. + // This property must be specified if the share profile `availability_mode` is `zonal`, + // and must not be specified otherwise. Zone ZoneIdentityIntf `json:"zone,omitempty"` } @@ -133734,7 +136865,10 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res } // SharePrototypeShareBySourceSnapshot : Create a file share from a source snapshot. The initial value for `access_control_mode`, -// `bandwidth`, and `zone` will be inherited from `source_snapshot`. +// `bandwidth`, `initial_owner` and `zone` will be inherited from `source_snapshot`. +// +// Shares can only be created from a source snapshot if the source share has a +// `storage_generation` of `1`. // This model "extends" SharePrototype type SharePrototypeShareBySourceSnapshot struct { // The transit encryption modes to allow for this share. If unspecified: @@ -133753,7 +136887,7 @@ type SharePrototypeShareBySourceSnapshot struct { ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // Tags for this resource. + // The tags for this resource. UserTags []string `json:"user_tags,omitempty"` // The access protocols to allow for this share. If unspecified: @@ -133769,10 +136903,6 @@ type SharePrototypeShareBySourceSnapshot struct { // 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. // // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be @@ -133781,7 +136911,9 @@ type SharePrototypeShareBySourceSnapshot struct { 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. + // for this file share. The profile must: + // - support the share's specified IOPS and size, and + // - have the same `storage_generation` as the source snapshot. Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource @@ -133794,7 +136926,7 @@ type SharePrototypeShareBySourceSnapshot struct { // If unspecified, the source snapshot's `minimum_size` will be used. Size *int64 `json:"size,omitempty"` - // The source snapshot for this file share. + // The source snapshot to clone this file share from. // // 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` @@ -133869,11 +137001,6 @@ func UnmarshalSharePrototypeShareBySourceSnapshot(m map[string]json.RawMessage, 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()) @@ -134039,8 +137166,9 @@ type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct 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. + // The data-consistent member snapshots to create. Each snapshot must specify a + // `source_volume` attached to the same virtual server instance, and all source volumes must have a + // `storage_generation` value of `1`. Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots" validate:"required"` } @@ -134195,7 +137323,13 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac // SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct // This model "extends" SnapshotPrototype type SnapshotPrototypeSnapshotBySourceSnapshot struct { - // Clones to create for this snapshot. + // The usage constraints to match against the requested instance or bare metal server properties to determine + // compatibility. + // + // Can only be specified for bootable snapshots. + AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` + + // The 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 @@ -134242,6 +137376,11 @@ func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { // 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) @@ -134279,7 +137418,13 @@ func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMes // SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct // This model "extends" SnapshotPrototype type SnapshotPrototypeSnapshotBySourceVolume struct { - // Clones to create for this snapshot. + // The usage constraints to match against the requested instance or bare metal server properties to determine + // compatibility. + // + // Can only be specified for bootable snapshots. + AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` + + // The 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 @@ -134314,6 +137459,11 @@ 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) @@ -135381,6 +138531,16 @@ func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) return } +// asPatch returns a generic map representation of the VPCIdentityByCRN +func (vpcIdentityByCRN *VPCIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcIdentityByCRN.CRN) { + _patch["crn"] = vpcIdentityByCRN.CRN + } + + return +} + // VPCIdentityByHref : VPCIdentityByHref struct // This model "extends" VPCIdentity type VPCIdentityByHref struct { @@ -135416,6 +138576,16 @@ func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{} return } +// asPatch returns a generic map representation of the VPCIdentityByHref +func (vpcIdentityByHref *VPCIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcIdentityByHref.Href) { + _patch["href"] = vpcIdentityByHref.Href + } + + return +} + // VPCIdentityByID : VPCIdentityByID struct // This model "extends" VPCIdentity type VPCIdentityByID struct { @@ -135451,6 +138621,16 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) return } +// asPatch returns a generic map representation of the VPCIdentityByID +func (vpcIdentityByID *VPCIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcIdentityByID.ID) { + _patch["id"] = vpcIdentityByID.ID + } + + return +} + // VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct // This model "extends" VPNGatewayConnectionIkeIdentityPrototype type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { @@ -136863,7 +140043,7 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer" validate:"required"` - // Routing protocols are disabled for this VPN gateway connection. + // The routing protocol for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` } @@ -136881,7 +140061,7 @@ const ( ) // Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// The routing protocol for this VPN gateway connection. const ( VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" ) @@ -137037,7 +140217,7 @@ type VPNGatewayConnectionRouteMode struct { Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` - // Routing protocols are disabled for this VPN gateway connection. + // The routing protocol for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` // The VPN tunnel configuration for this VPN gateway connection (in static route mode). @@ -137090,7 +140270,7 @@ const ( ) // Constants associated with the VPNGatewayConnectionRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// The routing protocol for this VPN gateway connection. const ( VPNGatewayConnectionRouteModeRoutingProtocolNoneConst = "none" ) @@ -137323,7 +140503,7 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByF // VPNGatewayPolicyMode : VPNGatewayPolicyMode struct // This model "extends" VPNGateway type VPNGatewayPolicyMode struct { - // Connections for this VPN gateway. + // The connections for this VPN gateway. Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` // The date and time that this VPN gateway was created. @@ -137373,7 +140553,7 @@ type VPNGatewayPolicyMode struct { // The VPC this VPN gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` - // Policy mode VPN gateway. + // The mode for this VPN gateway. Mode *string `json:"mode" validate:"required"` } @@ -137411,7 +140591,7 @@ const ( ) // Constants associated with the VPNGatewayPolicyMode.Mode property. -// Policy mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayPolicyModeModePolicyConst = "policy" ) @@ -137518,20 +140698,21 @@ type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Policy mode VPN gateway. - Mode *string `json:"mode,omitempty"` + // The mode for this VPN gateway. + Mode *string `json:"mode" validate:"required"` } // Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// Policy mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" ) // NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf, mode string) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ Subnet: subnet, + Mode: core.StringPtr(mode), } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -137582,12 +140763,12 @@ type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Route mode VPN gateway. + // The mode for this VPN gateway. Mode *string `json:"mode,omitempty"` } // Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// Route mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" ) @@ -137638,7 +140819,7 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json. // VPNGatewayRouteMode : VPNGatewayRouteMode struct // This model "extends" VPNGateway type VPNGatewayRouteMode struct { - // Connections for this VPN gateway. + // The connections for this VPN gateway. Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` // The date and time that this VPN gateway was created. @@ -137688,7 +140869,7 @@ type VPNGatewayRouteMode struct { // The VPC this VPN gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` - // Route mode VPN gateway. + // The mode for this VPN gateway. Mode *string `json:"mode" validate:"required"` } @@ -137726,7 +140907,7 @@ const ( ) // Constants associated with the VPNGatewayRouteMode.Mode property. -// Route mode VPN gateway. +// The mode for this VPN gateway. const ( VPNGatewayRouteModeModeRouteConst = "route" ) @@ -138561,6 +141742,13 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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. @@ -138626,6 +141814,11 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-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()) @@ -139795,6 +142988,13 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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. // @@ -139871,6 +143071,11 @@ func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) @@ -143001,7 +146206,6 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -143048,9 +146252,6 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // 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. @@ -143067,8 +146268,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // `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. + // The [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. @@ -143242,7 +146443,6 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -143289,9 +146489,6 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // 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. @@ -143308,8 +146505,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // `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. + // The [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. @@ -143483,7 +146680,6 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -143530,9 +146726,6 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // 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. @@ -143549,8 +146742,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // `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. + // The [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. @@ -143725,7 +146918,6 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -143772,9 +146964,6 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // 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. @@ -143791,8 +146980,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // `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. + // The [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. @@ -143967,7 +147156,6 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -144014,9 +147202,6 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // 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. @@ -144033,8 +147218,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // `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. + // The [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. @@ -144201,7 +147386,6 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -144248,9 +147432,6 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // 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. @@ -144267,8 +147448,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // `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. + // The [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. @@ -144435,7 +147616,6 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -144482,9 +147662,6 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // 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. @@ -144501,8 +147678,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // `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. + // The [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. @@ -144669,7 +147846,6 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -144716,9 +147892,6 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // 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. @@ -144735,8 +147908,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // `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. + // The [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. @@ -144903,7 +148076,6 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -144948,9 +148120,6 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // 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. @@ -144967,8 +148136,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // `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. + // The [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. @@ -145142,7 +148311,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -145187,9 +148355,6 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // 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. @@ -145206,8 +148371,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // `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. + // The [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. @@ -145381,7 +148546,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -145426,9 +148590,6 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // 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. @@ -145445,8 +148606,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // `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. + // The [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. @@ -145621,7 +148782,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -145666,9 +148826,6 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // 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. @@ -145685,8 +148842,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // `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. + // The [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. @@ -145861,7 +149018,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -145906,9 +149062,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // 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. @@ -145925,8 +149078,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // `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. + // The [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. @@ -146093,7 +149246,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -146138,9 +149290,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // 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. @@ -146157,8 +149306,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // `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. + // The [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. @@ -146325,7 +149474,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -146381,9 +149529,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // 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. @@ -146401,8 +149546,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // `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. + // The [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. @@ -146582,7 +149727,6 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -146638,9 +149782,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // 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. @@ -146658,8 +149799,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // `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. + // The [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. @@ -146839,7 +149980,6 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -146895,9 +150035,6 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // 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. @@ -146915,8 +150052,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // `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. + // The [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. @@ -147097,7 +150234,6 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -147153,9 +150289,6 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // 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. @@ -147173,8 +150306,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // `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. + // The [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. @@ -147355,7 +150488,6 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -147411,9 +150543,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // 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. @@ -147431,8 +150560,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // `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. + // The [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. @@ -147613,7 +150742,6 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns // 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 cluster network attachments to create for this virtual server instance. A cluster network attachment represents @@ -147669,9 +150797,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // 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. @@ -147689,8 +150814,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // `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. + // The [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. @@ -150078,7 +153203,7 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` - // Routing protocols are disabled for this VPN gateway connection. + // The routing protocol 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). @@ -150131,7 +153256,7 @@ const ( ) // Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// The routing protocol for this VPN gateway connection. const ( VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" ) @@ -150670,6 +153795,13 @@ 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 usage constraints to be matched against requested instance or bare metal server + // properties to determine compatibility. + // + // Can only be specified if `source_snapshot` is bootable. If not specified, the value of + // this property will be inherited from the `source_snapshot`. + AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` + // 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. // @@ -150744,6 +153876,11 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) @@ -151001,25 +154138,25 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt return } -// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -type VPCAddressPrefixesPager struct { +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { hasNext bool - options *ListVPCAddressPrefixesOptions + options *ListBackupPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. -func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, 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 ListVPCAddressPrefixesOptions = *options - pager = &VPCAddressPrefixesPager{ + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151028,19 +154165,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 *BackupPoliciesPager) 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 *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.ListVPCAddressPrefixesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151059,16 +154196,16 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AddressPrefixes + page = result.BackupPolicies 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 *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { for pager.HasNext() { - var nextPage []AddressPrefix + var nextPage []BackupPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151080,38 +154217,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 *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 *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, 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 { +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { hasNext bool - options *ListVPCDnsResolutionBindingsOptions + options *ListBackupPolicyJobsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. -func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, 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 = 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 ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151120,19 +154257,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 *BackupPolicyJobsPager) 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 *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.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151151,16 +154288,16 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.DnsResolutionBindings + page = result.Jobs 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 *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { for pager.HasNext() { - var nextPage []VpcdnsResolutionBinding + var nextPage []BackupPolicyJob nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151172,38 +154309,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 *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 *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, 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 { +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { hasNext bool - options *ListVPCRoutesOptions + options *ListBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutesPager returns a new VPCRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, 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 ListVPCRoutesOptions = *options - pager = &VPCRoutesPager{ + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151212,19 +154349,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 *BareMetalServerProfilesPager) 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) { +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.ListVPCRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151243,16 +154380,16 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.Profiles 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) { +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { for pager.HasNext() { - var nextPage []Route + var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151264,38 +154401,38 @@ 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 *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 *VPCRoutesPager) GetAll() (allItems []Route, err error) { +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, 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 { +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { hasNext bool - options *ListVPCRoutingTableRoutesOptions + options *ListBareMetalServersOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, 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 ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151304,19 +154441,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 *BareMetalServersPager) 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 *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.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151335,16 +154472,16 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.BareMetalServers 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 *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { for pager.HasNext() { - var nextPage []Route + var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151356,38 +154493,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 *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 *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, 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 { +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { hasNext bool - options *ListVPCRoutingTablesOptions + options *ListBareMetalServerNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. -func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, 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 ListVPCRoutingTablesOptions = *options - pager = &VPCRoutingTablesPager{ + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151396,19 +154533,19 @@ func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTablesPager) HasNext() bool { +func (pager *BareMetalServerNetworkAttachmentsPager) 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) { +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.ListVPCRoutingTablesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151427,16 +154564,16 @@ func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.RoutingTables + page = result.NetworkAttachments 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) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { for pager.HasNext() { - var nextPage []RoutingTable + var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151448,38 +154585,38 @@ 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) { +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 *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, 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 { +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { hasNext bool - options *ListVpcsOptions + options *ListBareMetalServerNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, 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 ListVpcsOptions = *options - pager = &VpcsPager{ + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151488,19 +154625,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 *BareMetalServerNetworkInterfacesPager) 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 *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.ListVpcsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151519,16 +154656,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.NetworkInterfaces 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 *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { for pager.HasNext() { - var nextPage []VPC + var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151540,38 +154677,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 *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 *VpcsPager) GetAll() (allItems []VPC, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, 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 { +// ClusterNetworkProfilesPager can be used to simplify the use of the "ListClusterNetworkProfiles" method. +type ClusterNetworkProfilesPager struct { hasNext bool - options *ListSubnetReservedIpsOptions + options *ListClusterNetworkProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { +// 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 ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ + var optionsCopy ListClusterNetworkProfilesOptions = *options + pager = &ClusterNetworkProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151580,19 +154717,387 @@ 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 *ClusterNetworkProfilesPager) 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 *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.ListSubnetReservedIpsWithContext(ctx, pager.options) + 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 @@ -151618,7 +155123,467 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa // 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 *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 +} + +// 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 +} + +// 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 +} + +// 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) @@ -151632,38 +155597,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 *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 *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *EndpointGatewayIpsPager) 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 { +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { hasNext bool - options *ListSubnetsOptions + options *ListFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetsPager returns a new SubnetsPager instance. -func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, 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 ListSubnetsOptions = *options - pager = &SubnetsPager{ + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151672,19 +155637,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 *FloatingIpsPager) 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 *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.ListSubnetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151703,16 +155668,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.FloatingIps 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 *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { for pager.HasNext() { - var nextPage []Subnet + var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151724,14 +155689,106 @@ 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 *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 *SubnetsPager) GetAll() (allItems []Subnet, err error) { +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, 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 @@ -151829,25 +155886,25 @@ func (pager *ImagesPager) GetAll() (allItems []Image, err error) { return } -// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. -type OperatingSystemsPager struct { +// ImageBareMetalServerProfilesPager can be used to simplify the use of the "ListImageBareMetalServerProfiles" method. +type ImageBareMetalServerProfilesPager struct { hasNext bool - options *ListOperatingSystemsOptions + options *ListImageBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. -func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { +// NewImageBareMetalServerProfilesPager returns a new ImageBareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewImageBareMetalServerProfilesPager(options *ListImageBareMetalServerProfilesOptions) (pager *ImageBareMetalServerProfilesPager, 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{ + var optionsCopy ListImageBareMetalServerProfilesOptions = *options + pager = &ImageBareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151856,19 +155913,19 @@ func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *OperatingSystemsPager) HasNext() bool { +func (pager *ImageBareMetalServerProfilesPager) 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) { +func (pager *ImageBareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfileReference, 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) + result, _, err := pager.client.ListImageBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151887,16 +155944,16 @@ func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.OperatingSystems + page = result.BareMetalServerProfiles 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) { +func (pager *ImageBareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfileReference, err error) { for pager.HasNext() { - var nextPage []OperatingSystem + var nextPage []BareMetalServerProfileReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -151908,38 +155965,38 @@ 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) { +func (pager *ImageBareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfileReference, 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) { +func (pager *ImageBareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfileReference, 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 { +// ImageInstanceProfilesPager can be used to simplify the use of the "ListImageInstanceProfiles" method. +type ImageInstanceProfilesPager struct { hasNext bool - options *ListKeysOptions + options *ListImageInstanceProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewKeysPager returns a new KeysPager instance. -func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { +// NewImageInstanceProfilesPager returns a new ImageInstanceProfilesPager instance. +func (vpc *VpcV1) NewImageInstanceProfilesPager(options *ListImageInstanceProfilesOptions) (pager *ImageInstanceProfilesPager, 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{ + var optionsCopy ListImageInstanceProfilesOptions = *options + pager = &ImageInstanceProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -151948,19 +156005,19 @@ func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *KeysPager) HasNext() bool { +func (pager *ImageInstanceProfilesPager) 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) { +func (pager *ImageInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, 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) + result, _, err := pager.client.ListImageInstanceProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -151979,16 +156036,16 @@ func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Keys + page = result.InstanceProfiles 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) { +func (pager *ImageInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { for pager.HasNext() { - var nextPage []Key + var nextPage []InstanceProfileReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152000,38 +156057,38 @@ 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) { +func (pager *ImageInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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) { +func (pager *ImageInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceClusterNetworkAttachmentsPager can be used to simplify the use of the "ListInstanceClusterNetworkAttachments" method. -type InstanceClusterNetworkAttachmentsPager struct { +// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. +type OperatingSystemsPager struct { hasNext bool - options *ListInstanceClusterNetworkAttachmentsOptions + options *ListOperatingSystemsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceClusterNetworkAttachmentsPager returns a new InstanceClusterNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewInstanceClusterNetworkAttachmentsPager(options *ListInstanceClusterNetworkAttachmentsOptions) (pager *InstanceClusterNetworkAttachmentsPager, err error) { +// 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 ListInstanceClusterNetworkAttachmentsOptions = *options - pager = &InstanceClusterNetworkAttachmentsPager{ + var optionsCopy ListOperatingSystemsOptions = *options + pager = &OperatingSystemsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152040,19 +156097,19 @@ func (vpc *VpcV1) NewInstanceClusterNetworkAttachmentsPager(options *ListInstanc } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceClusterNetworkAttachmentsPager) HasNext() bool { +func (pager *OperatingSystemsPager) 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) { +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.ListInstanceClusterNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152071,16 +156128,16 @@ func (pager *InstanceClusterNetworkAttachmentsPager) GetNextWithContext(ctx cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.ClusterNetworkAttachments + page = result.OperatingSystems 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) { +func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { for pager.HasNext() { - var nextPage []InstanceClusterNetworkAttachment + var nextPage []OperatingSystem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152092,38 +156149,38 @@ func (pager *InstanceClusterNetworkAttachmentsPager) GetAllWithContext(ctx conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceClusterNetworkAttachmentsPager) GetNext() (page []InstanceClusterNetworkAttachment, err error) { +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 *InstanceClusterNetworkAttachmentsPager) GetAll() (allItems []InstanceClusterNetworkAttachment, err error) { +func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, 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 { +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { hasNext bool - options *ListInstanceNetworkInterfaceIpsOptions + options *ListInstanceGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, 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 ListInstanceNetworkInterfaceIpsOptions = *options - pager = &InstanceNetworkInterfaceIpsPager{ + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152132,19 +156189,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 *InstanceGroupsPager) 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 *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.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152163,16 +156220,16 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.InstanceGroups 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 *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []InstanceGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152184,38 +156241,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 *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 *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, 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 { +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +type InstanceGroupManagersPager struct { hasNext bool - options *ListInstancesOptions + options *ListInstanceGroupManagersOptions client *VpcV1 pageContext struct { next *string } } -// NewInstancesPager returns a new InstancesPager instance. -func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, 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 ListInstancesOptions = *options - pager = &InstancesPager{ + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152224,19 +156281,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 *InstanceGroupManagersPager) 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 *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.ListInstancesWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152255,16 +156312,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.Managers 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 *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { for pager.HasNext() { - var nextPage []Instance + var nextPage []InstanceGroupManagerIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152276,14 +156333,14 @@ 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 *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 *InstancesPager) GetAll() (allItems []Instance, err error) { +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -152473,25 +156530,25 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGro return } -// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -type InstanceGroupManagersPager struct { +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +type InstanceGroupMembershipsPager struct { hasNext bool - options *ListInstanceGroupManagersOptions + options *ListInstanceGroupMembershipsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. -func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, 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 ListInstanceGroupManagersOptions = *options - pager = &InstanceGroupManagersPager{ + var optionsCopy ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152500,19 +156557,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 *InstanceGroupMembershipsPager) 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 *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.ListInstanceGroupManagersWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152531,16 +156588,16 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Managers + page = result.Memberships 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 *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerIntf + var nextPage []InstanceGroupMembership nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152552,38 +156609,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 *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 *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, 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 { +// InstancesPager can be used to simplify the use of the "ListInstances" method. +type InstancesPager struct { hasNext bool - options *ListInstanceGroupMembershipsOptions + options *ListInstancesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. -func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, 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 ListInstanceGroupMembershipsOptions = *options - pager = &InstanceGroupMembershipsPager{ + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152592,19 +156649,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 *InstancesPager) 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 *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.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152623,16 +156680,16 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Memberships + page = result.Instances 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 *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { for pager.HasNext() { - var nextPage []InstanceGroupMembership + var nextPage []Instance nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152644,38 +156701,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 *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 *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, 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 { +// InstanceClusterNetworkAttachmentsPager can be used to simplify the use of the "ListInstanceClusterNetworkAttachments" method. +type InstanceClusterNetworkAttachmentsPager struct { hasNext bool - options *ListInstanceGroupsOptions + options *ListInstanceClusterNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { +// 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 ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ + var optionsCopy ListInstanceClusterNetworkAttachmentsOptions = *options + pager = &InstanceClusterNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152684,19 +156741,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 *InstanceClusterNetworkAttachmentsPager) 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 *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.ListInstanceGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceClusterNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152715,16 +156772,16 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.InstanceGroups + page = result.ClusterNetworkAttachments 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 *InstanceClusterNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceClusterNetworkAttachment, err error) { for pager.HasNext() { - var nextPage []InstanceGroup + var nextPage []InstanceClusterNetworkAttachment nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152736,38 +156793,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 *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 *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { +func (pager *InstanceClusterNetworkAttachmentsPager) GetAll() (allItems []InstanceClusterNetworkAttachment, 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 { +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +type InstanceNetworkInterfaceIpsPager struct { hasNext bool - options *ListReservationsOptions + options *ListInstanceNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewReservationsPager returns a new ReservationsPager instance. -func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, 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 ListReservationsOptions = *options - pager = &ReservationsPager{ + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152776,19 +156833,19 @@ func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ReservationsPager) HasNext() bool { +func (pager *InstanceNetworkInterfaceIpsPager) 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) { +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.ListReservationsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152807,16 +156864,16 @@ func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page [] } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Reservations + page = result.Ips 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) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []Reservation + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152828,38 +156885,38 @@ 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) { +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 *ReservationsPager) GetAll() (allItems []Reservation, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, 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 { +// KeysPager can be used to simplify the use of the "ListKeys" method. +type KeysPager struct { hasNext bool - options *ListDedicatedHostGroupsOptions + options *ListKeysOptions client *VpcV1 pageContext struct { next *string } } -// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. -func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { +// 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 ListDedicatedHostGroupsOptions = *options - pager = &DedicatedHostGroupsPager{ + var optionsCopy ListKeysOptions = *options + pager = &KeysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152868,19 +156925,19 @@ func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOp } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostGroupsPager) HasNext() bool { +func (pager *KeysPager) 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) { +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.ListDedicatedHostGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152899,16 +156956,16 @@ func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) ( } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Groups + page = result.Keys 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) { +func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { for pager.HasNext() { - var nextPage []DedicatedHostGroup + var nextPage []Key nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -152920,38 +156977,38 @@ 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) { +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 *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { +func (pager *KeysPager) GetAll() (allItems []Key, 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 { +// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. +type LoadBalancerProfilesPager struct { hasNext bool - options *ListDedicatedHostProfilesOptions + options *ListLoadBalancerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. -func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { +// 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 ListDedicatedHostProfilesOptions = *options - pager = &DedicatedHostProfilesPager{ + var optionsCopy ListLoadBalancerProfilesOptions = *options + pager = &LoadBalancerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -152960,19 +157017,19 @@ func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfil } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostProfilesPager) HasNext() bool { +func (pager *LoadBalancerProfilesPager) 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) { +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.ListDedicatedHostProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -152998,9 +157055,9 @@ func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) // 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) { +func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { for pager.HasNext() { - var nextPage []DedicatedHostProfile + var nextPage []LoadBalancerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153012,38 +157069,38 @@ 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) { +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 *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { +func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, 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 { +// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. +type LoadBalancersPager struct { hasNext bool - options *ListDedicatedHostsOptions + options *ListLoadBalancersOptions client *VpcV1 pageContext struct { next *string } } -// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. -func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { +// 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 ListDedicatedHostsOptions = *options - pager = &DedicatedHostsPager{ + var optionsCopy ListLoadBalancersOptions = *options + pager = &LoadBalancersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153052,19 +157109,19 @@ func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostsPager) HasNext() bool { +func (pager *LoadBalancersPager) 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) { +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.ListDedicatedHostsWithContext(ctx, pager.options) + result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153083,16 +157140,16 @@ func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.DedicatedHosts + page = result.LoadBalancers 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) { +func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { for pager.HasNext() { - var nextPage []DedicatedHost + var nextPage []LoadBalancer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153104,38 +157161,38 @@ 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) { +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 *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { +func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, 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 { +// LoadBalancerPoolMembersPager can be used to simplify the use of the "ListLoadBalancerPoolMembers" method. +type LoadBalancerPoolMembersPager struct { hasNext bool - options *ListPlacementGroupsOptions + options *ListLoadBalancerPoolMembersOptions client *VpcV1 pageContext struct { next *string } } -// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. -func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { +// NewLoadBalancerPoolMembersPager returns a new LoadBalancerPoolMembersPager instance. +func (vpc *VpcV1) NewLoadBalancerPoolMembersPager(options *ListLoadBalancerPoolMembersOptions) (pager *LoadBalancerPoolMembersPager, 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{ + var optionsCopy ListLoadBalancerPoolMembersOptions = *options + pager = &LoadBalancerPoolMembersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153144,19 +157201,19 @@ 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 *LoadBalancerPoolMembersPager) 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 *LoadBalancerPoolMembersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerPoolMember, 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.ListLoadBalancerPoolMembersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153175,16 +157232,16 @@ func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.PlacementGroups + page = result.Members 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 *LoadBalancerPoolMembersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerPoolMember, err error) { for pager.HasNext() { - var nextPage []PlacementGroup + var nextPage []LoadBalancerPoolMember nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153196,38 +157253,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) { +func (pager *LoadBalancerPoolMembersPager) GetNext() (page []LoadBalancerPoolMember, 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) { +func (pager *LoadBalancerPoolMembersPager) GetAll() (allItems []LoadBalancerPoolMember, 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 { +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions + options *ListNetworkAclsOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, 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 ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153236,19 +157293,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 *NetworkAclsPager) 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 *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.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153267,16 +157324,16 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAttachments + page = result.NetworkAcls 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 *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf + var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153288,38 +157345,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 *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 *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, 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 { +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +type NetworkACLRulesPager struct { hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions + options *ListNetworkACLRulesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, 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 ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153328,19 +157385,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 *NetworkACLRulesPager) 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 *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.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153359,16 +157416,16 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkInterfaces + page = result.Rules 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 *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf + var nextPage []NetworkACLRuleItemIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153380,38 +157437,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 *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 *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, 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 { +// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. +type PlacementGroupsPager struct { hasNext bool - options *ListBareMetalServerProfilesOptions + options *ListPlacementGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, 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 = 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 ListPlacementGroupsOptions = *options + pager = &PlacementGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153420,19 +157477,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 *PlacementGroupsPager) 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 *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.ListBareMetalServerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153451,16 +157508,16 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.PlacementGroups 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 *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { for pager.HasNext() { - var nextPage []BareMetalServerProfile + var nextPage []PlacementGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153472,38 +157529,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 *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 *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { +func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, 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 { +// PrivatePathServiceGatewaysPager can be used to simplify the use of the "ListPrivatePathServiceGateways" method. +type PrivatePathServiceGatewaysPager struct { hasNext bool - options *ListBareMetalServersOptions + options *ListPrivatePathServiceGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { +// 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 ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ + var optionsCopy ListPrivatePathServiceGatewaysOptions = *options + pager = &PrivatePathServiceGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153512,19 +157569,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 *PrivatePathServiceGatewaysPager) 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 *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.ListBareMetalServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListPrivatePathServiceGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153543,16 +157600,16 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.BareMetalServers + page = result.PrivatePathServiceGateways 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 *PrivatePathServiceGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGateway, err error) { for pager.HasNext() { - var nextPage []BareMetalServer + var nextPage []PrivatePathServiceGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153564,38 +157621,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 *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 *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { +func (pager *PrivatePathServiceGatewaysPager) GetAll() (allItems []PrivatePathServiceGateway, 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 { +// PrivatePathServiceGatewayAccountPoliciesPager can be used to simplify the use of the "ListPrivatePathServiceGatewayAccountPolicies" method. +type PrivatePathServiceGatewayAccountPoliciesPager struct { hasNext bool - options *ListVolumeProfilesOptions + options *ListPrivatePathServiceGatewayAccountPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. -func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { +// 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 ListVolumeProfilesOptions = *options - pager = &VolumeProfilesPager{ + var optionsCopy ListPrivatePathServiceGatewayAccountPoliciesOptions = *options + pager = &PrivatePathServiceGatewayAccountPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153604,19 +157661,19 @@ 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 *PrivatePathServiceGatewayAccountPoliciesPager) 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 *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.ListVolumeProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153635,16 +157692,16 @@ func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.AccountPolicies 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 *PrivatePathServiceGatewayAccountPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGatewayAccountPolicy, err error) { for pager.HasNext() { - var nextPage []VolumeProfile + var nextPage []PrivatePathServiceGatewayAccountPolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153656,38 +157713,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) { +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 *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { +func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetAll() (allItems []PrivatePathServiceGatewayAccountPolicy, 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 { +// PrivatePathServiceGatewayEndpointGatewayBindingsPager can be used to simplify the use of the "ListPrivatePathServiceGatewayEndpointGatewayBindings" method. +type PrivatePathServiceGatewayEndpointGatewayBindingsPager struct { hasNext bool - options *ListVolumesOptions + options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewVolumesPager returns a new VolumesPager instance. -func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { +// 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 ListVolumesOptions = *options - pager = &VolumesPager{ + var optionsCopy ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions = *options + pager = &PrivatePathServiceGatewayEndpointGatewayBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153696,19 +157753,19 @@ 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 *PrivatePathServiceGatewayEndpointGatewayBindingsPager) 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 *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.ListVolumesWithContext(ctx, pager.options) + result, _, err := pager.client.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153727,16 +157784,16 @@ func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volum } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Volumes + page = result.EndpointGatewayBindings 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 *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGatewayEndpointGatewayBinding, err error) { for pager.HasNext() { - var nextPage []Volume + var nextPage []PrivatePathServiceGatewayEndpointGatewayBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153748,38 +157805,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) { +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 *VolumesPager) GetAll() (allItems []Volume, err error) { +func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAll() (allItems []PrivatePathServiceGatewayEndpointGatewayBinding, 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 { +// PublicAddressRangesPager can be used to simplify the use of the "ListPublicAddressRanges" method. +type PublicAddressRangesPager struct { hasNext bool - options *ListSnapshotConsistencyGroupsOptions + options *ListPublicAddressRangesOptions client *VpcV1 pageContext struct { next *string } } -// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. -func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { +// NewPublicAddressRangesPager returns a new PublicAddressRangesPager instance. +func (vpc *VpcV1) NewPublicAddressRangesPager(options *ListPublicAddressRangesOptions) (pager *PublicAddressRangesPager, 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{ + var optionsCopy ListPublicAddressRangesOptions = *options + pager = &PublicAddressRangesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153788,19 +157845,19 @@ 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 *PublicAddressRangesPager) 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 *PublicAddressRangesPager) GetNextWithContext(ctx context.Context) (page []PublicAddressRange, 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.ListPublicAddressRangesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153819,16 +157876,16 @@ func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.SnapshotConsistencyGroups + page = result.PublicAddressRanges 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 *PublicAddressRangesPager) GetAllWithContext(ctx context.Context) (allItems []PublicAddressRange, err error) { for pager.HasNext() { - var nextPage []SnapshotConsistencyGroup + var nextPage []PublicAddressRange nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153840,38 +157897,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) { +func (pager *PublicAddressRangesPager) GetNext() (page []PublicAddressRange, 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) { +func (pager *PublicAddressRangesPager) GetAll() (allItems []PublicAddressRange, 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 { +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { hasNext bool - options *ListSnapshotsOptions + options *ListPublicGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewSnapshotsPager returns a new SnapshotsPager instance. -func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, 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 ListSnapshotsOptions = *options - pager = &SnapshotsPager{ + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153880,19 +157937,19 @@ 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 *PublicGatewaysPager) 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 *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.ListSnapshotsWithContext(ctx, pager.options) + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -153911,16 +157968,16 @@ func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Sna } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Snapshots + page = result.PublicGateways 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 *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { for pager.HasNext() { - var nextPage []Snapshot + var nextPage []PublicGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -153932,38 +157989,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) { +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 *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, 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 { +// ReservationsPager can be used to simplify the use of the "ListReservations" method. +type ReservationsPager struct { hasNext bool - options *ListShareAccessorBindingsOptions + options *ListReservationsOptions client *VpcV1 pageContext struct { next *string } } -// NewShareAccessorBindingsPager returns a new ShareAccessorBindingsPager instance. -func (vpc *VpcV1) NewShareAccessorBindingsPager(options *ListShareAccessorBindingsOptions) (pager *ShareAccessorBindingsPager, err error) { +// 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 ListShareAccessorBindingsOptions = *options - pager = &ShareAccessorBindingsPager{ + var optionsCopy ListReservationsOptions = *options + pager = &ReservationsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -153972,19 +158029,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 *ReservationsPager) 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 *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.ListShareAccessorBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListReservationsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154003,16 +158060,16 @@ func (pager *ShareAccessorBindingsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AccessorBindings + page = result.Reservations 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 *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems []Reservation, err error) { for pager.HasNext() { - var nextPage []ShareAccessorBinding + var nextPage []Reservation nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154024,38 +158081,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 *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 *ShareAccessorBindingsPager) GetAll() (allItems []ShareAccessorBinding, err error) { +func (pager *ReservationsPager) GetAll() (allItems []Reservation, 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 { +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { hasNext bool - options *ListShareMountTargetsOptions + options *ListSecurityGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, 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 ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154064,19 +158121,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 *SecurityGroupsPager) 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 *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.ListShareMountTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154095,16 +158152,16 @@ func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (pa } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.MountTargets + page = result.SecurityGroups 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 *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { for pager.HasNext() { - var nextPage []ShareMountTarget + var nextPage []SecurityGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154116,38 +158173,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 *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 *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, 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 { +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +type SecurityGroupTargetsPager struct { hasNext bool - options *ListShareProfilesOptions + options *ListSecurityGroupTargetsOptions client *VpcV1 pageContext struct { next *string } } -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, 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 ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ + var optionsCopy ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154156,19 +158213,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 *SecurityGroupTargetsPager) 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 *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.ListShareProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154187,16 +158244,16 @@ func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.Targets 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 *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { for pager.HasNext() { - var nextPage []ShareProfile + var nextPage []SecurityGroupTargetReferenceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154208,38 +158265,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 *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 *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { +func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// ShareSnapshotsPager can be used to simplify the use of the "ListShareSnapshots" method. -type ShareSnapshotsPager struct { +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { hasNext bool - options *ListShareSnapshotsOptions + options *ListShareProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewShareSnapshotsPager returns a new ShareSnapshotsPager instance. -func (vpc *VpcV1) NewShareSnapshotsPager(options *ListShareSnapshotsOptions) (pager *ShareSnapshotsPager, 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 ListShareSnapshotsOptions = *options - pager = &ShareSnapshotsPager{ + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154248,19 +158305,19 @@ func (vpc *VpcV1) NewShareSnapshotsPager(options *ListShareSnapshotsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareSnapshotsPager) HasNext() bool { +func (pager *ShareProfilesPager) 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) { +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.ListShareSnapshotsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154279,16 +158336,16 @@ func (pager *ShareSnapshotsPager) GetNextWithContext(ctx context.Context) (page } 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 *ShareSnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []ShareSnapshot, err error) { +func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { for pager.HasNext() { - var nextPage []ShareSnapshot + var nextPage []ShareProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154300,14 +158357,14 @@ func (pager *ShareSnapshotsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareSnapshotsPager) GetNext() (page []ShareSnapshot, 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 *ShareSnapshotsPager) GetAll() (allItems []ShareSnapshot, err error) { +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -154405,209 +158462,25 @@ func (pager *SharesPager) GetAll() (allItems []Share, err error) { 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 { +// ShareAccessorBindingsPager can be used to simplify the use of the "ListShareAccessorBindings" method. +type ShareAccessorBindingsPager struct { hasNext bool - options *ListNetworkInterfaceFloatingIpsOptions + options *ListShareAccessorBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. -func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, 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 ListNetworkInterfaceFloatingIpsOptions = *options - pager = &NetworkInterfaceFloatingIpsPager{ + var optionsCopy ListShareAccessorBindingsOptions = *options + pager = &ShareAccessorBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154616,19 +158489,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 *ShareAccessorBindingsPager) 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 *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.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareAccessorBindingsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154647,16 +158520,16 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps + page = result.AccessorBindings 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 *ShareAccessorBindingsPager) GetAllWithContext(ctx context.Context) (allItems []ShareAccessorBinding, err error) { for pager.HasNext() { - var nextPage []FloatingIPReference + var nextPage []ShareAccessorBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154668,38 +158541,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 *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 *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { +func (pager *ShareAccessorBindingsPager) GetAll() (allItems []ShareAccessorBinding, 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 { +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { hasNext bool - options *ListVirtualNetworkInterfaceIpsOptions + options *ListShareMountTargetsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, 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 ListVirtualNetworkInterfaceIpsOptions = *options - pager = &VirtualNetworkInterfaceIpsPager{ + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154708,19 +158581,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 *ShareMountTargetsPager) 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 *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.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154739,16 +158612,16 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.MountTargets 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 *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { for pager.HasNext() { - var nextPage []ReservedIPReference + var nextPage []ShareMountTarget nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154760,38 +158633,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 *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 *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, 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 { +// ShareSnapshotsPager can be used to simplify the use of the "ListShareSnapshots" method. +type ShareSnapshotsPager struct { hasNext bool - options *ListVirtualNetworkInterfacesOptions + options *ListShareSnapshotsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { +// 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 ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ + var optionsCopy ListShareSnapshotsOptions = *options + pager = &ShareSnapshotsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154800,19 +158673,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 *ShareSnapshotsPager) 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 *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.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareSnapshotsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154831,16 +158704,16 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces + page = result.Snapshots 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 *ShareSnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []ShareSnapshot, err error) { for pager.HasNext() { - var nextPage []VirtualNetworkInterface + var nextPage []ShareSnapshot nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154852,38 +158725,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 *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 *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { +func (pager *ShareSnapshotsPager) GetAll() (allItems []ShareSnapshot, 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 { +// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. +type SnapshotConsistencyGroupsPager struct { hasNext bool - options *ListClusterNetworkInterfacesOptions + options *ListSnapshotConsistencyGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewClusterNetworkInterfacesPager returns a new ClusterNetworkInterfacesPager instance. -func (vpc *VpcV1) NewClusterNetworkInterfacesPager(options *ListClusterNetworkInterfacesOptions) (pager *ClusterNetworkInterfacesPager, 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 = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListClusterNetworkInterfacesOptions = *options - pager = &ClusterNetworkInterfacesPager{ + var optionsCopy ListSnapshotConsistencyGroupsOptions = *options + pager = &SnapshotConsistencyGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154892,19 +158765,19 @@ func (vpc *VpcV1) NewClusterNetworkInterfacesPager(options *ListClusterNetworkIn } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ClusterNetworkInterfacesPager) HasNext() bool { +func (pager *SnapshotConsistencyGroupsPager) 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) { +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.ListClusterNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -154923,16 +158796,16 @@ func (pager *ClusterNetworkInterfacesPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Interfaces + page = result.SnapshotConsistencyGroups 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) { +func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { for pager.HasNext() { - var nextPage []ClusterNetworkInterface + var nextPage []SnapshotConsistencyGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -154944,38 +158817,38 @@ func (pager *ClusterNetworkInterfacesPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ClusterNetworkInterfacesPager) GetNext() (page []ClusterNetworkInterface, err error) { +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 *ClusterNetworkInterfacesPager) GetAll() (allItems []ClusterNetworkInterface, err error) { +func (pager *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// ClusterNetworkProfilesPager can be used to simplify the use of the "ListClusterNetworkProfiles" method. -type ClusterNetworkProfilesPager struct { +// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. +type SnapshotsPager struct { hasNext bool - options *ListClusterNetworkProfilesOptions + options *ListSnapshotsOptions client *VpcV1 pageContext struct { next *string } } -// NewClusterNetworkProfilesPager returns a new ClusterNetworkProfilesPager instance. -func (vpc *VpcV1) NewClusterNetworkProfilesPager(options *ListClusterNetworkProfilesOptions) (pager *ClusterNetworkProfilesPager, 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 = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListClusterNetworkProfilesOptions = *options - pager = &ClusterNetworkProfilesPager{ + var optionsCopy ListSnapshotsOptions = *options + pager = &SnapshotsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -154984,19 +158857,19 @@ func (vpc *VpcV1) NewClusterNetworkProfilesPager(options *ListClusterNetworkProf } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ClusterNetworkProfilesPager) HasNext() bool { +func (pager *SnapshotsPager) 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) { +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.ListClusterNetworkProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155015,16 +158888,16 @@ func (pager *ClusterNetworkProfilesPager) GetNextWithContext(ctx context.Context } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.Snapshots 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) { +func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { for pager.HasNext() { - var nextPage []ClusterNetworkProfile + var nextPage []Snapshot nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155036,38 +158909,38 @@ func (pager *ClusterNetworkProfilesPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ClusterNetworkProfilesPager) GetNext() (page []ClusterNetworkProfile, err error) { +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 *ClusterNetworkProfilesPager) GetAll() (allItems []ClusterNetworkProfile, err error) { +func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, 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 { +// SnapshotInstanceProfilesPager can be used to simplify the use of the "ListSnapshotInstanceProfiles" method. +type SnapshotInstanceProfilesPager struct { hasNext bool - options *ListClusterNetworkSubnetReservedIpsOptions + options *ListSnapshotInstanceProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewClusterNetworkSubnetReservedIpsPager returns a new ClusterNetworkSubnetReservedIpsPager instance. -func (vpc *VpcV1) NewClusterNetworkSubnetReservedIpsPager(options *ListClusterNetworkSubnetReservedIpsOptions) (pager *ClusterNetworkSubnetReservedIpsPager, err error) { +// NewSnapshotInstanceProfilesPager returns a new SnapshotInstanceProfilesPager instance. +func (vpc *VpcV1) NewSnapshotInstanceProfilesPager(options *ListSnapshotInstanceProfilesOptions) (pager *SnapshotInstanceProfilesPager, 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{ + var optionsCopy ListSnapshotInstanceProfilesOptions = *options + pager = &SnapshotInstanceProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155076,19 +158949,19 @@ func (vpc *VpcV1) NewClusterNetworkSubnetReservedIpsPager(options *ListClusterNe } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ClusterNetworkSubnetReservedIpsPager) HasNext() bool { +func (pager *SnapshotInstanceProfilesPager) 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) { +func (pager *SnapshotInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, 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) + result, _, err := pager.client.ListSnapshotInstanceProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155107,16 +158980,16 @@ func (pager *ClusterNetworkSubnetReservedIpsPager) GetNextWithContext(ctx contex } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.ReservedIps + page = result.InstanceProfiles 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) { +func (pager *SnapshotInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { for pager.HasNext() { - var nextPage []ClusterNetworkSubnetReservedIP + var nextPage []InstanceProfileReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155128,38 +159001,38 @@ func (pager *ClusterNetworkSubnetReservedIpsPager) GetAllWithContext(ctx context } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ClusterNetworkSubnetReservedIpsPager) GetNext() (page []ClusterNetworkSubnetReservedIP, err error) { +func (pager *SnapshotInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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) { +func (pager *SnapshotInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, 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 { +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +type SubnetsPager struct { hasNext bool - options *ListClusterNetworkSubnetsOptions + options *ListSubnetsOptions client *VpcV1 pageContext struct { next *string } } -// NewClusterNetworkSubnetsPager returns a new ClusterNetworkSubnetsPager instance. -func (vpc *VpcV1) NewClusterNetworkSubnetsPager(options *ListClusterNetworkSubnetsOptions) (pager *ClusterNetworkSubnetsPager, 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 ListClusterNetworkSubnetsOptions = *options - pager = &ClusterNetworkSubnetsPager{ + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155168,19 +159041,19 @@ func (vpc *VpcV1) NewClusterNetworkSubnetsPager(options *ListClusterNetworkSubne } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ClusterNetworkSubnetsPager) HasNext() bool { +func (pager *SubnetsPager) 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) { +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.ListClusterNetworkSubnetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155206,9 +159079,9 @@ func (pager *ClusterNetworkSubnetsPager) GetNextWithContext(ctx context.Context) // 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) { +func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { for pager.HasNext() { - var nextPage []ClusterNetworkSubnet + var nextPage []Subnet nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155220,38 +159093,38 @@ func (pager *ClusterNetworkSubnetsPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ClusterNetworkSubnetsPager) GetNext() (page []ClusterNetworkSubnet, 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 *ClusterNetworkSubnetsPager) GetAll() (allItems []ClusterNetworkSubnet, err error) { +func (pager *SubnetsPager) GetAll() (allItems []Subnet, 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 { +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { hasNext bool - options *ListClusterNetworksOptions + options *ListSubnetReservedIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewClusterNetworksPager returns a new ClusterNetworksPager instance. -func (vpc *VpcV1) NewClusterNetworksPager(options *ListClusterNetworksOptions) (pager *ClusterNetworksPager, 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 ListClusterNetworksOptions = *options - pager = &ClusterNetworksPager{ + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155260,19 +159133,19 @@ func (vpc *VpcV1) NewClusterNetworksPager(options *ListClusterNetworksOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ClusterNetworksPager) HasNext() bool { +func (pager *SubnetReservedIpsPager) 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) { +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.ListClusterNetworksWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155291,16 +159164,16 @@ func (pager *ClusterNetworksPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.ClusterNetworks + page = result.ReservedIps 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) { +func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []ClusterNetwork + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155312,38 +159185,38 @@ func (pager *ClusterNetworksPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ClusterNetworksPager) GetNext() (page []ClusterNetwork, 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 *ClusterNetworksPager) GetAll() (allItems []ClusterNetwork, err error) { +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, 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 { +// 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, @@ -155352,19 +159225,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 @@ -155383,16 +159256,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") @@ -155404,38 +159277,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 { +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { hasNext bool - options *ListFloatingIpsOptions + options *ListNetworkInterfaceFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, 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 ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155444,19 +159317,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 *NetworkInterfaceFloatingIpsPager) 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 *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.ListFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155482,193 +159355,9 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F // 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) { +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { for pager.HasNext() { - var nextPage []NetworkACL + var nextPage []FloatingIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155680,38 +159369,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 *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 *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, 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 { +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { hasNext bool - options *ListSecurityGroupTargetsOptions + options *ListVirtualNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. -func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, 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 ListSecurityGroupTargetsOptions = *options - pager = &SecurityGroupTargetsPager{ + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155720,19 +159409,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 *VirtualNetworkInterfaceIpsPager) 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 *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.ListSecurityGroupTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155751,16 +159440,16 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Targets + page = result.Ips 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 *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { for pager.HasNext() { - var nextPage []SecurityGroupTargetReferenceIntf + var nextPage []ReservedIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155772,38 +159461,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 *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 *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, 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 { +// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. +type VolumeProfilesPager struct { hasNext bool - options *ListSecurityGroupsOptions + options *ListVolumeProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, 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 = 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 ListVolumeProfilesOptions = *options + pager = &VolumeProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155812,19 +159501,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 *VolumeProfilesPager) 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 *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.ListSecurityGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155843,16 +159532,16 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.SecurityGroups + page = result.Profiles 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 *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { for pager.HasNext() { - var nextPage []SecurityGroup + var nextPage []VolumeProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155864,38 +159553,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 *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 *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { +func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, 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 { +// VolumesPager can be used to simplify the use of the "ListVolumes" method. +type VolumesPager struct { hasNext bool - options *ListIkePoliciesOptions + options *ListVolumesOptions client *VpcV1 pageContext struct { next *string } } -// NewIkePoliciesPager returns a new IkePoliciesPager instance. -func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, 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 = 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 ListVolumesOptions = *options + pager = &VolumesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155904,19 +159593,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 *VolumesPager) 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 *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.ListIkePoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -155935,16 +159624,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.Volumes 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 *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { for pager.HasNext() { - var nextPage []IkePolicy + var nextPage []Volume nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -155956,38 +159645,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 *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 *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { +func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// IkePolicyConnectionsPager can be used to simplify the use of the "ListIkePolicyConnections" method. -type IkePolicyConnectionsPager struct { +// VolumeInstanceProfilesPager can be used to simplify the use of the "ListVolumeInstanceProfiles" method. +type VolumeInstanceProfilesPager struct { hasNext bool - options *ListIkePolicyConnectionsOptions + options *ListVolumeInstanceProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewIkePolicyConnectionsPager returns a new IkePolicyConnectionsPager instance. -func (vpc *VpcV1) NewIkePolicyConnectionsPager(options *ListIkePolicyConnectionsOptions) (pager *IkePolicyConnectionsPager, err error) { +// NewVolumeInstanceProfilesPager returns a new VolumeInstanceProfilesPager instance. +func (vpc *VpcV1) NewVolumeInstanceProfilesPager(options *ListVolumeInstanceProfilesOptions) (pager *VolumeInstanceProfilesPager, 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 ListIkePolicyConnectionsOptions = *options - pager = &IkePolicyConnectionsPager{ + var optionsCopy ListVolumeInstanceProfilesOptions = *options + pager = &VolumeInstanceProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -155996,19 +159685,19 @@ func (vpc *VpcV1) NewIkePolicyConnectionsPager(options *ListIkePolicyConnections } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *IkePolicyConnectionsPager) HasNext() bool { +func (pager *VolumeInstanceProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *IkePolicyConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { +func (pager *VolumeInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListIkePolicyConnectionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVolumeInstanceProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156027,16 +159716,16 @@ func (pager *IkePolicyConnectionsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Connections + page = result.InstanceProfiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VolumeInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf + var nextPage []InstanceProfileReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156048,38 +159737,38 @@ func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) ( } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IkePolicyConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, err error) { +func (pager *VolumeInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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 *IkePolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VolumeInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, 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 { +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { hasNext bool - options *ListIpsecPoliciesOptions + options *ListVpcsOptions client *VpcV1 pageContext struct { next *string } } -// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. -func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, 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 ListIpsecPoliciesOptions = *options - pager = &IpsecPoliciesPager{ + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156088,19 +159777,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 *VpcsPager) 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 *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.ListIpsecPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156119,16 +159808,16 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.IpsecPolicies + page = result.Vpcs 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 *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { for pager.HasNext() { - var nextPage []IPsecPolicy + var nextPage []VPC nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156140,38 +159829,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 *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 *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// IpsecPolicyConnectionsPager can be used to simplify the use of the "ListIpsecPolicyConnections" method. -type IpsecPolicyConnectionsPager struct { +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +type VPCAddressPrefixesPager struct { hasNext bool - options *ListIpsecPolicyConnectionsOptions + options *ListVPCAddressPrefixesOptions client *VpcV1 pageContext struct { next *string } } -// NewIpsecPolicyConnectionsPager returns a new IpsecPolicyConnectionsPager instance. -func (vpc *VpcV1) NewIpsecPolicyConnectionsPager(options *ListIpsecPolicyConnectionsOptions) (pager *IpsecPolicyConnectionsPager, 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 ListIpsecPolicyConnectionsOptions = *options - pager = &IpsecPolicyConnectionsPager{ + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156180,19 +159869,19 @@ func (vpc *VpcV1) NewIpsecPolicyConnectionsPager(options *ListIpsecPolicyConnect } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *IpsecPolicyConnectionsPager) HasNext() bool { +func (pager *VPCAddressPrefixesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *IpsecPolicyConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, 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.ListIpsecPolicyConnectionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156211,16 +159900,16 @@ func (pager *IpsecPolicyConnectionsPager) GetNextWithContext(ctx context.Context } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Connections + page = result.AddressPrefixes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf + var nextPage []AddressPrefix nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156232,38 +159921,38 @@ func (pager *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IpsecPolicyConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, 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 { +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { hasNext bool - options *ListVPNGatewayConnectionsOptions + options *ListVPCDnsResolutionBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. -func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, 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 ListVPNGatewayConnectionsOptions = *options - pager = &VPNGatewayConnectionsPager{ + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156272,19 +159961,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 *VPCDnsResolutionBindingsPager) 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 *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.ListVPNGatewayConnectionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156303,16 +159992,16 @@ func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Connections + page = result.DnsResolutionBindings 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 *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf + var nextPage []VpcdnsResolutionBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156324,38 +160013,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 *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 *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, 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 { +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +type VPCRoutesPager struct { hasNext bool - options *ListVPNGatewaysOptions + options *ListVPCRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, 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 ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156364,19 +160053,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 *VPCRoutesPager) 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 *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.ListVPNGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156395,16 +160084,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.Routes 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 *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { for pager.HasNext() { - var nextPage []VPNGatewayIntf + var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156416,38 +160105,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 *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 *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { +func (pager *VPCRoutesPager) GetAll() (allItems []Route, 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 { +// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. +type VPCRoutingTablesPager struct { hasNext bool - options *ListVPNServerClientsOptions + options *ListVPCRoutingTablesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { +// 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 ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ + var optionsCopy ListVPCRoutingTablesOptions = *options + pager = &VPCRoutingTablesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156456,19 +160145,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 *VPCRoutingTablesPager) 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 *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.ListVPNServerClientsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156487,16 +160176,16 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Clients + page = result.RoutingTables 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 *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { for pager.HasNext() { - var nextPage []VPNServerClient + var nextPage []RoutingTable nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156508,38 +160197,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 *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 *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { +func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, 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 { +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { hasNext bool - options *ListVPNServerRoutesOptions + options *ListVPCRoutingTableRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, 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 ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156548,19 +160237,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 *VPCRoutingTableRoutesPager) 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 *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.ListVPNServerRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156586,9 +160275,9 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page // 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 *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { for pager.HasNext() { - var nextPage []VPNServerRoute + var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156600,38 +160289,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 *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 *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, 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 { +// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. +type IkePoliciesPager struct { hasNext bool - options *ListVPNServersOptions + options *ListIkePoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, 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 ListVPNServersOptions = *options - pager = &VPNServersPager{ + var optionsCopy ListIkePoliciesOptions = *options + pager = &IkePoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156640,19 +160329,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 *IkePoliciesPager) 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 *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.ListVPNServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156671,16 +160360,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.IkePolicies 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 *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { for pager.HasNext() { - var nextPage []VPNServer + var nextPage []IkePolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156692,38 +160381,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 *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 *VPNServersPager) GetAll() (allItems []VPNServer, err error) { +func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, 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 { +// IkePolicyConnectionsPager can be used to simplify the use of the "ListIkePolicyConnections" method. +type IkePolicyConnectionsPager struct { hasNext bool - options *ListLoadBalancerProfilesOptions + options *ListIkePolicyConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. -func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, 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 ListLoadBalancerProfilesOptions = *options - pager = &LoadBalancerProfilesPager{ + var optionsCopy ListIkePolicyConnectionsOptions = *options + pager = &IkePolicyConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156732,19 +160421,19 @@ func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfiles } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancerProfilesPager) HasNext() bool { +func (pager *IkePolicyConnectionsPager) 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) { +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.ListLoadBalancerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListIkePolicyConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156763,16 +160452,16 @@ func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.Connections 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) { +func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []LoadBalancerProfile + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156784,38 +160473,38 @@ 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) { +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 *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { +func (pager *IkePolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 { +// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. +type IpsecPoliciesPager struct { hasNext bool - options *ListLoadBalancersOptions + options *ListIpsecPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewLoadBalancersPager returns a new LoadBalancersPager instance. -func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, 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 ListLoadBalancersOptions = *options - pager = &LoadBalancersPager{ + var optionsCopy ListIpsecPoliciesOptions = *options + pager = &IpsecPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156824,19 +160513,19 @@ func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (page } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancersPager) HasNext() bool { +func (pager *IpsecPoliciesPager) 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) { +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.ListLoadBalancersWithContext(ctx, pager.options) + result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156855,16 +160544,16 @@ func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.LoadBalancers + page = result.IpsecPolicies 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) { +func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { for pager.HasNext() { - var nextPage []LoadBalancer + var nextPage []IPsecPolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156876,38 +160565,38 @@ 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) { +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 *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { +func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, 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 { +// IpsecPolicyConnectionsPager can be used to simplify the use of the "ListIpsecPolicyConnections" method. +type IpsecPolicyConnectionsPager struct { hasNext bool - options *ListEndpointGatewayIpsOptions + options *ListIpsecPolicyConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, 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 ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ + var optionsCopy ListIpsecPolicyConnectionsOptions = *options + pager = &IpsecPolicyConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -156916,19 +160605,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 *IpsecPolicyConnectionsPager) 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 *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.ListEndpointGatewayIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListIpsecPolicyConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -156947,16 +160636,16 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.Connections 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 *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -156968,38 +160657,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 *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 *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 { +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { hasNext bool - options *ListEndpointGatewaysOptions + options *ListVPNGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, 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 ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -157008,19 +160697,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 *VPNGatewaysPager) 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 *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.ListEndpointGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -157039,16 +160728,16 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGateways + page = result.VPNGateways 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 *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { for pager.HasNext() { - var nextPage []EndpointGateway + var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -157060,38 +160749,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 *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 *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, 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 { +// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. +type VPNGatewayConnectionsPager struct { hasNext bool - options *ListFlowLogCollectorsOptions + options *ListVPNGatewayConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. -func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, 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 ListFlowLogCollectorsOptions = *options - pager = &FlowLogCollectorsPager{ + var optionsCopy ListVPNGatewayConnectionsOptions = *options + pager = &VPNGatewayConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -157100,19 +160789,19 @@ func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOption } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *FlowLogCollectorsPager) HasNext() bool { +func (pager *VPNGatewayConnectionsPager) 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) { +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.ListFlowLogCollectorsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -157131,16 +160820,16 @@ func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (pa } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FlowLogCollectors + page = result.Connections 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) { +func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []FlowLogCollector + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -157152,38 +160841,38 @@ 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) { +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 *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { +func (pager *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 { +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { hasNext bool - options *ListPrivatePathServiceGatewayAccountPoliciesOptions + options *ListVPNServersOptions client *VpcV1 pageContext struct { next *string } } -// NewPrivatePathServiceGatewayAccountPoliciesPager returns a new PrivatePathServiceGatewayAccountPoliciesPager instance. -func (vpc *VpcV1) NewPrivatePathServiceGatewayAccountPoliciesPager(options *ListPrivatePathServiceGatewayAccountPoliciesOptions) (pager *PrivatePathServiceGatewayAccountPoliciesPager, 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 ListPrivatePathServiceGatewayAccountPoliciesOptions = *options - pager = &PrivatePathServiceGatewayAccountPoliciesPager{ + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -157192,19 +160881,19 @@ func (vpc *VpcV1) NewPrivatePathServiceGatewayAccountPoliciesPager(options *List } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PrivatePathServiceGatewayAccountPoliciesPager) HasNext() bool { +func (pager *VPNServersPager) 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) { +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.ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -157223,16 +160912,16 @@ func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetNextWithContext(c } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AccountPolicies + page = result.VPNServers 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) { +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { for pager.HasNext() { - var nextPage []PrivatePathServiceGatewayAccountPolicy + var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -157244,38 +160933,38 @@ func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetAllWithContext(ct } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetNext() (page []PrivatePathServiceGatewayAccountPolicy, 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 *PrivatePathServiceGatewayAccountPoliciesPager) GetAll() (allItems []PrivatePathServiceGatewayAccountPolicy, err error) { +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, 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 { +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { hasNext bool - options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions + options *ListVPNServerClientsOptions client *VpcV1 pageContext struct { next *string } } -// NewPrivatePathServiceGatewayEndpointGatewayBindingsPager returns a new PrivatePathServiceGatewayEndpointGatewayBindingsPager instance. -func (vpc *VpcV1) NewPrivatePathServiceGatewayEndpointGatewayBindingsPager(options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager, 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 ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions = *options - pager = &PrivatePathServiceGatewayEndpointGatewayBindingsPager{ + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -157284,19 +160973,19 @@ func (vpc *VpcV1) NewPrivatePathServiceGatewayEndpointGatewayBindingsPager(optio } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) HasNext() bool { +func (pager *VPNServerClientsPager) 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) { +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.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -157315,16 +161004,16 @@ func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetNextWithC } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGatewayBindings + page = result.Clients 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) { +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { for pager.HasNext() { - var nextPage []PrivatePathServiceGatewayEndpointGatewayBinding + var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -157336,38 +161025,38 @@ func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAllWithCo } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetNext() (page []PrivatePathServiceGatewayEndpointGatewayBinding, 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 *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAll() (allItems []PrivatePathServiceGatewayEndpointGatewayBinding, err error) { +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// PrivatePathServiceGatewaysPager can be used to simplify the use of the "ListPrivatePathServiceGateways" method. -type PrivatePathServiceGatewaysPager struct { +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { hasNext bool - options *ListPrivatePathServiceGatewaysOptions + options *ListVPNServerRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewPrivatePathServiceGatewaysPager returns a new PrivatePathServiceGatewaysPager instance. -func (vpc *VpcV1) NewPrivatePathServiceGatewaysPager(options *ListPrivatePathServiceGatewaysOptions) (pager *PrivatePathServiceGatewaysPager, 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 ListPrivatePathServiceGatewaysOptions = *options - pager = &PrivatePathServiceGatewaysPager{ + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -157376,19 +161065,19 @@ func (vpc *VpcV1) NewPrivatePathServiceGatewaysPager(options *ListPrivatePathSer } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PrivatePathServiceGatewaysPager) HasNext() bool { +func (pager *VPNServerRoutesPager) 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) { +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.ListPrivatePathServiceGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -157407,16 +161096,16 @@ func (pager *PrivatePathServiceGatewaysPager) GetNextWithContext(ctx context.Con } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.PrivatePathServiceGateways + page = result.Routes 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) { +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { for pager.HasNext() { - var nextPage []PrivatePathServiceGateway + var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -157428,14 +161117,14 @@ func (pager *PrivatePathServiceGatewaysPager) GetAllWithContext(ctx context.Cont } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PrivatePathServiceGatewaysPager) GetNext() (page []PrivatePathServiceGateway, 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 *PrivatePathServiceGatewaysPager) GetAll() (allItems []PrivatePathServiceGateway, err error) { +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return From 87e910064db7f185b0f8ae1ec0d8cb1ef27d3578 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Thu, 18 Sep 2025 19:03:22 +0530 Subject: [PATCH 09/13] updates to SDK and other schema items --- .../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 | 66 - .../IBM/vpc-go-sdk/common/headers_test.go | 28 - .../IBM/vpc-go-sdk/common/version.go | 4 - common/github.com/IBM/vpc-go-sdk/go.mod | 41 - common/github.com/IBM/vpc-go-sdk/go.sum | 77 - .../IBM/vpc-go-sdk/package-lock.json | 828 - .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 161131 --------------- go.mod | 4 +- go.sum | 4 +- ibm/service/vpc/data_source_ibm_is_share.go | 19 + .../vpc/data_source_ibm_is_share_profile.go | 283 +- .../vpc/data_source_ibm_is_share_profiles.go | 163 + .../vpc/data_source_ibm_is_share_snapshot.go | 2 +- .../data_source_ibm_is_share_snapshot_test.go | 2 +- .../vpc/data_source_ibm_is_share_snapshots.go | 13 +- ...data_source_ibm_is_share_snapshots_test.go | 4 +- .../vpc/data_source_ibm_is_share_test.go | 1 + ibm/service/vpc/data_source_ibm_is_shares.go | 16 + .../vpc/data_source_ibm_is_shares_test.go | 1 + ibm/service/vpc/resource_ibm_is_share.go | 109 +- .../vpc/resource_ibm_is_share_mount_target.go | 4 +- .../vpc/resource_ibm_is_share_snapshot.go | 11 +- .../resource_ibm_is_share_snapshot_test.go | 2 +- ibm/service/vpc/resource_ibm_is_share_test.go | 44 + website/docs/d/is_share.html.markdown | 4 + website/docs/d/is_share_profile.html.markdown | 35 +- .../docs/d/is_share_profiles.html.markdown | 21 + website/docs/d/is_shares.html.markdown | 4 + 39 files changed, 698 insertions(+), 162920 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 ec4e7f8c0e..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ /dev/null @@ -1,66 +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_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_REQUEST_ID] = GetNewXRequestID() - - return sdkHeaders -} - -var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) - -func GetUserAgentInfo() string { - return UserAgent -} -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 64f0f82272..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ /dev/null @@ -1,28 +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_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 3c8b8f1217..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.44.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 1c1ab5e0a0..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ /dev/null @@ -1,41 +0,0 @@ -module github.com/IBM/vpc-go-sdk - -go 1.21 - -toolchain go1.22.2 - -require ( - 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 - 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 049bc3b5c0..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ /dev/null @@ -1,77 +0,0 @@ -github.com/IBM/go-sdk-core/v5 v5.18.1 h1:wdftQO8xejECTWTKF3FGXyW0McKxxDAopH7MKwA187c= -github.com/IBM/go-sdk-core/v5 v5.18.1/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -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.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= -github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= -github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= -github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.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/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -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.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -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= -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/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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -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 bd15339f69..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ /dev/null @@ -1,161131 +0,0 @@ -/** - * (C) Copyright IBM Corp. 2025. - * - * 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.107.0-b68ebf7a-20250811-145645 - */ - -// 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: 2025-08-26 -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 `2025-08-26` - // and `2025-09-17`. - Version *string -} - -// DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://au-syd.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 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 `2025-08-26` - // and `2025-09-17`. - 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 - } - } - if options.Version == nil { - options.Version = core.StringPtr("2025-09-17") - } - service = &VpcV1{ - Service: baseService, - Generation: options.Generation, - Version: options.Version, - } - - if service.Generation == nil { - service.Generation = core.Int64Ptr(2) - } - - return -} - -// GetServiceURLForRegion returns the service URL to be used for the specified region -func GetServiceURLForRegion(region string) (string, error) { - var endpoints = map[string]string{ - "au-syd": "https://au-syd.iaas.cloud.ibm.com/v1", // Australia (Sydney) - "br-sao": "https://br-sao.iaas.cloud.ibm.com/v1", // Brazil (Sao Paulo) - "ca-mon": "https://ca-mon.iaas.cloud.ibm.com/v1", // Canada (Montreal) - "ca-tor": "https://ca-tor.iaas.cloud.ibm.com/v1", // Canada (Toronto) - "eu-de": "https://eu-de.iaas.cloud.ibm.com/v1", // Germany (Frankfurt) - "eu-es": "https://eu-es.iaas.cloud.ibm.com/v1", // Spain (Madrid) - "eu-gb": "https://eu-gb.iaas.cloud.ibm.com/v1", // United Kingdom (London) - "jp-osa": "https://jp-osa.iaas.cloud.ibm.com/v1", // Japan (Osaka) - "jp-tok": "https://jp-tok.iaas.cloud.ibm.com/v1", // Japan (Tokyo) - "us-east": "https://us-east.iaas.cloud.ibm.com/v1", // US East (Washington DC) - "us-south": "https://us-south.iaas.cloud.ibm.com/v1", // US South (Dallas) - } - - if url, ok := endpoints[region]; ok { - return url, nil - } - return "", core.SDKErrorf(nil, fmt.Sprintf("service URL for region '%s' not found", region), "invalid-region", 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() -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBackupPoliciesOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 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(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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBackupPolicyOptions.Headers { - 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 -} - -// 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 - } - - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServersOptions.Headers { - 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.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)) - } - 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 -} - -// 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. -// -// For this request to succeed, the properties in the request must adhere to the source image's `allowed_use` property. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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. 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, "") - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { - 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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. -// -// For this request to succeed, the properties in the request must adhere to the `allowed_use` property of the disk -// referenced in the server's `boot_target`. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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. -// -// For this request to succeed, the properties of the server which would result from the reinitialization must adhere to -// the specified image's `allowed_use` property. -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 -} - -// 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(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *replaceBareMetalServerInitializationOptions.ID, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceBareMetalServerInitialization") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range replaceBareMetalServerInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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.DefaultTrustedProfile != nil { - body["default_trusted_profile"] = replaceBareMetalServerInitializationOptions.DefaultTrustedProfile - } - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "replace_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 -} - -// RestartBareMetalServer : Restart a bare metal 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, "") - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range restartBareMetalServerOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range startBareMetalServerOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range stopBareMetalServerOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_network/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listClusterNetworkProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listClusterNetworkProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start)) - } - if listClusterNetworkProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.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_cluster_network_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// 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 -} - -// 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(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - 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, `/cluster_network/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getClusterNetworkProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_cluster_network_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - 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 - } - - 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 - } - - 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, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listClusterNetworksOptions.Headers { - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalClusterNetworkCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// 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 -} - -// 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(createClusterNetworkOptions, "createClusterNetworkOptions") - 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, `/cluster_networks`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetwork") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createClusterNetworkOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listClusterNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - 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 { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalClusterNetworkInterfaceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// 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 -} - -// 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(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createClusterNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 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 - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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 - } - - 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, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteClusterNetworkInterfaceOptions.Headers { - 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)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - 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, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getClusterNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_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 -} - -// 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 -} - -// 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(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "cluster_network_id": *updateClusterNetworkInterfaceOptions.ClusterNetworkID, - "id": *updateClusterNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateClusterNetworkInterfaceOptions.Headers { - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listClusterNetworkSubnetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - 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 { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalClusterNetworkSubnetCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// 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 -} - -// 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(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createClusterNetworkSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - 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 -} - -// 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 -} - -// 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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listClusterNetworkSubnetReservedIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listClusterNetworkSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start)) - } - if listClusterNetworkSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit)) - } - 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() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalClusterNetworkSubnetReservedIPCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// 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 -} - -// 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(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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createClusterNetworkSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 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 - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteClusterNetworkSubnetReservedIPOptions.Headers { - 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)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getClusterNetworkSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_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 -} - -// 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 -} - -// 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(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateClusterNetworkSubnetReservedIPOptions.Headers { - 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(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID, - "id": *deleteClusterNetworkSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteClusterNetworkSubnetOptions.Headers { - 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)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_cluster_network_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getClusterNetworkSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_cluster_network_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - 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 -} - -// 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 -} - -// 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(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID, - "id": *updateClusterNetworkSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateClusterNetworkSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_cluster_network_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - 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 -} - -// 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 -} - -// 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(deleteClusterNetworkOptions, "deleteClusterNetworkOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteClusterNetworkOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetwork") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteClusterNetworkOptions.Headers { - 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)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// 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 -} - -// 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(getClusterNetworkOptions, "getClusterNetworkOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getClusterNetworkOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getClusterNetworkOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_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 -} - -// 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 -} - -// 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(updateClusterNetworkOptions, "updateClusterNetworkOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateClusterNetworkOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetwork") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateClusterNetworkOptions.Headers { - 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(updateClusterNetworkOptions.ClusterNetworkPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_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 -} - -// ListDedicatedHostGroups : List dedicated host groups -// 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, "") - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listDedicatedHostsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// DeleteDedicatedHost : Delete 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, "") - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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. -// -// The endpoint gateways will be sorted by their `created_at` property values, with newest endpoint gateway first. -// Endpoint gateways with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { - 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.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 { - err = core.SDKErrorf(err, "", "build-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 -} - -// CreateEndpointGateway : Create an endpoint gateway -// This request creates a new endpoint gateway from an endpoint gateway prototype object. The prototype object is -// structured in the same way as a retrieved endpoint gateway, and contains the information necessary to create a new -// endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target service 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// UpdateEndpointGateway : Update an endpoint gateway -// This request updates an endpoint gateway with the information in a provided endpoint gateway patch. The endpoint -// gateway patch object is structured in the same way as a retrieved endpoint gateway and contains only the information -// to be updated. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listFloatingIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteFloatingIPOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 TCP and UDP 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { - 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, `/flow_log_collectors`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listRegionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getRegionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listRegionZonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getRegionZoneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listImagesOptions.Headers { - 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)) - } - if listImagesOptions.UserDataFormat != nil { - builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) - } - if listImagesOptions.RemoteAccountID != nil { - builder.AddQuery("remote.account.id", fmt.Sprint(*listImagesOptions.RemoteAccountID)) - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// DeleteImage : Delete an image -// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be -// reversed. An image with `remote.account` set 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteImageOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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. An image with `remote.account` set -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// ListImageBareMetalServerProfiles : List bare metal server profiles compatible with an image -// This request lists bare metal server profiles compatible with an image's -// `allowed_use.bare_metal_server`, `operating_system.architecture` and -// `user_data_format` properties, sorted by ascending `name` property values. -func (vpc *VpcV1) ListImageBareMetalServerProfiles(listImageBareMetalServerProfilesOptions *ListImageBareMetalServerProfilesOptions) (result *ImageBareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImageBareMetalServerProfilesWithContext(context.Background(), listImageBareMetalServerProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListImageBareMetalServerProfilesWithContext is an alternate form of the ListImageBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListImageBareMetalServerProfilesWithContext(ctx context.Context, listImageBareMetalServerProfilesOptions *ListImageBareMetalServerProfilesOptions) (result *ImageBareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageBareMetalServerProfilesOptions, "listImageBareMetalServerProfilesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listImageBareMetalServerProfilesOptions, "listImageBareMetalServerProfilesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listImageBareMetalServerProfilesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/bare_metal_server_profiles`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageBareMetalServerProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listImageBareMetalServerProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listImageBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImageBareMetalServerProfilesOptions.Start)) - } - if listImageBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImageBareMetalServerProfilesOptions.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_image_bare_metal_server_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageBareMetalServerProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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 -// -// An image with `remote.account` set 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deprecateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - builder.AddQuery("maturity", fmt.Sprint(*deprecateImageOptions.Maturity)) - - request, err := builder.Build() - if 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 -} - -// ListImageInstanceProfiles : List instance profiles compatible with an image -// This request lists instance profiles compatible with an image's -// `allowed_use.instance`, `operating_system.architecture` and -// `user_data_format` properties, sorted by ascending `name` property values. -func (vpc *VpcV1) ListImageInstanceProfiles(listImageInstanceProfilesOptions *ListImageInstanceProfilesOptions) (result *ImageInstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImageInstanceProfilesWithContext(context.Background(), listImageInstanceProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListImageInstanceProfilesWithContext is an alternate form of the ListImageInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListImageInstanceProfilesWithContext(ctx context.Context, listImageInstanceProfilesOptions *ListImageInstanceProfilesOptions) (result *ImageInstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageInstanceProfilesOptions, "listImageInstanceProfilesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listImageInstanceProfilesOptions, "listImageInstanceProfilesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listImageInstanceProfilesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/instance_profiles`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageInstanceProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listImageInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listImageInstanceProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImageInstanceProfilesOptions.Start)) - } - if listImageInstanceProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImageInstanceProfilesOptions.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_image_instance_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageInstanceProfileCollection) - 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 -// -// An image with `remote.account` set 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range obsoleteImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - builder.AddQuery("maturity", fmt.Sprint(*obsoleteImageOptions.Maturity)) - - request, err := builder.Build() - if 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listImageExportJobsOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteImageExportJobOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listOperatingSystemsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getOperatingSystemOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceGroupsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstancesOptions.Headers { - 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.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)) - } - 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.ReservationAffinityPolicy != nil { - builder.AddQuery("reservation_affinity.policy", fmt.Sprint(*listInstancesOptions.ReservationAffinityPolicy)) - } - 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. -// -// For this request to succeed, the properties in the request must adhere to the source's -// `allowed_use` property. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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. -// -// For this request to succeed, the properties in the request must adhere to the -// `allowed_use` property in the volume referenced by `boot_volume_attachment.volume`. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceClusterNetworkAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceClusterNetworkAttachmentsOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createClusterNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceClusterNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceClusterNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceClusterNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceClusterNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listKeysOptions.Headers { - 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)) - } - if listKeysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.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_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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteKeyOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { - 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(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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancersOptions.Headers { - 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`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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()) - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 load balancer must be in the `application` family. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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, `/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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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.FailsafePolicy != nil { - body["failsafe_policy"] = createLoadBalancerPoolOptions.FailsafePolicy - } - 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 -} - -// 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, nor be the target pool in the failsafe policy for any other pool. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listLoadBalancerPoolMembersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerPoolMembersOptions.Start)) - } - if listLoadBalancerPoolMembersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerPoolMembersOptions.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_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 -} - -// CreateLoadBalancerPoolMember : Create a member in a load balancer pool -// This request creates a new member and adds the member to the pool. -// -// The pool must not already have a member targeting a load balancer. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// ListNetworkAcls : List network ACLs -// This request lists network ACLs in the region. A network ACL defines a set of packet filtering rules for traffic in -// and out of the subnets the network ACL is attached to. No traffic is allowed by default. Both allow and deny rules -// can be defined, and rules are stateless so that reverse traffic in response to allowed traffic is not automatically -// allowed. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listNetworkAclsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteNetworkACLOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPlacementGroupsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deletePlacementGroupOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updatePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deletePrivatePathServiceGatewayAccountPolicyOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range unpublishPrivatePathServiceGatewayOptions.Headers { - 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 -} - -// ListPublicAddressRanges : List public address ranges -// This request lists [public address ranges](https://cloud.ibm.com/docs/vpc?topic=vpc-about-par) in the region. A -// public address range is a contiguous block of public IP addresses that can be bound to a `target` that specifies a -// `vpc` and a `zone`. Incoming traffic for these IP addresses will be routed according to the VPC's ingress routing -// table. -func (vpc *VpcV1) ListPublicAddressRanges(listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPublicAddressRangesWithContext(context.Background(), listPublicAddressRangesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListPublicAddressRangesWithContext is an alternate form of the ListPublicAddressRanges method which supports a Context parameter -func (vpc *VpcV1) ListPublicAddressRangesWithContext(ctx context.Context, listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPublicAddressRangesOptions, "listPublicAddressRangesOptions") - 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_address_ranges`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicAddressRanges") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPublicAddressRangesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPublicAddressRangesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicAddressRangesOptions.Start)) - } - if listPublicAddressRangesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicAddressRangesOptions.Limit)) - } - if listPublicAddressRangesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicAddressRangesOptions.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_address_ranges", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRangeCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreatePublicAddressRange : Create a public address range -// This request creates a new public address range from a public address range prototype object. The prototype object is -// structured in the same way as a retrieved public address range, and contains the information necessary to create the -// new public address range. -func (vpc *VpcV1) CreatePublicAddressRange(createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreatePublicAddressRangeWithContext(context.Background(), createPublicAddressRangeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreatePublicAddressRangeWithContext is an alternate form of the CreatePublicAddressRange method which supports a Context parameter -func (vpc *VpcV1) CreatePublicAddressRangeWithContext(ctx context.Context, createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPublicAddressRangeOptions, "createPublicAddressRangeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createPublicAddressRangeOptions, "createPublicAddressRangeOptions") - 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_address_ranges`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicAddressRange") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createPublicAddressRangeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 createPublicAddressRangeOptions.Ipv4AddressCount != nil { - body["ipv4_address_count"] = createPublicAddressRangeOptions.Ipv4AddressCount - } - if createPublicAddressRangeOptions.Name != nil { - body["name"] = createPublicAddressRangeOptions.Name - } - if createPublicAddressRangeOptions.ResourceGroup != nil { - body["resource_group"] = createPublicAddressRangeOptions.ResourceGroup - } - if createPublicAddressRangeOptions.Target != nil { - body["target"] = createPublicAddressRangeOptions.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_public_address_range", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeletePublicAddressRange : Delete a public address range -// This request deletes a public address range. If the public address range is bound to a -// `target`, it will be unbound. This operation cannot be reversed. -func (vpc *VpcV1) DeletePublicAddressRange(deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeletePublicAddressRangeWithContext(context.Background(), deletePublicAddressRangeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeletePublicAddressRangeWithContext is an alternate form of the DeletePublicAddressRange method which supports a Context parameter -func (vpc *VpcV1) DeletePublicAddressRangeWithContext(ctx context.Context, deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deletePublicAddressRangeOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicAddressRange") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deletePublicAddressRangeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_public_address_range", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetPublicAddressRange : Retrieve a public address range -// This request retrieves a single public address range specified by the identifier in the URL. -func (vpc *VpcV1) GetPublicAddressRange(getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPublicAddressRangeWithContext(context.Background(), getPublicAddressRangeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetPublicAddressRangeWithContext is an alternate form of the GetPublicAddressRange method which supports a Context parameter -func (vpc *VpcV1) GetPublicAddressRangeWithContext(ctx context.Context, getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPublicAddressRangeOptions, "getPublicAddressRangeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getPublicAddressRangeOptions, "getPublicAddressRangeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getPublicAddressRangeOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicAddressRange") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPublicAddressRangeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_address_range", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdatePublicAddressRange : Update a public address range -// This request updates a public address range with the information in a provided public address range patch. The public -// address range patch object is structured in the same way as a retrieved public address range and contains only the -// information to be updated. -func (vpc *VpcV1) UpdatePublicAddressRange(updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePublicAddressRangeWithContext(context.Background(), updatePublicAddressRangeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdatePublicAddressRangeWithContext is an alternate form of the UpdatePublicAddressRange method which supports a Context parameter -func (vpc *VpcV1) UpdatePublicAddressRangeWithContext(ctx context.Context, updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updatePublicAddressRangeOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicAddressRange") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updatePublicAddressRangeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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(updatePublicAddressRangeOptions.PublicAddressRangePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "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_address_range", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listPublicGatewaysOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deletePublicGatewayOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updatePublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listReservationsOptions.Headers { - 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.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)) - } - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range activateReservationOptions.Headers { - 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 -} - -// ListSecurityGroups : List security groups -// This request lists security groups in the region. A security group defines a set of packet filtering rules to allow -// traffic in and out of the resources targeted by the security group. No traffic is allowed by default. Security group -// rules are stateful so that reverse traffic in response to allowed traffic is automatically allowed. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSecurityGroupsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listShareProfilesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSharesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteShareOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateShareOptions.Headers { - 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 -} - -// 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 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) { - result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { - 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}/accessor_bindings/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { - 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_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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareAccessorBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range failoverShareOptions.Headers { - 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 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listShareMountTargetsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listShareSnapshotsOptions.Headers { - 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 an `access_control_mode` of `security_group`, an -// `availability_mode` of `zonal`, and a `replication_role` of `source` or `none`. -// -// The snapshot will inherit its `resource_group` and encryption settings from the share. -// -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createShareSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteShareSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateShareSnapshotOptions.Headers { - 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 -// `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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteShareSourceOptions.Headers { - 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSnapshotsOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSnapshotsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSnapshotOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSnapshotOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSnapshotClonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// ListSnapshotInstanceProfiles : List instance profiles compatible with a snapshot -// This request lists instance profiles compatible with a snapshot's -// `allowed_use.instance`, `operating_system.architecture` and -// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified snapshot -// must be bootable. -func (vpc *VpcV1) ListSnapshotInstanceProfiles(listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotInstanceProfilesWithContext(context.Background(), listSnapshotInstanceProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSnapshotInstanceProfilesWithContext is an alternate form of the ListSnapshotInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotInstanceProfilesWithContext(ctx context.Context, listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listSnapshotInstanceProfilesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/instance_profiles`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotInstanceProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSnapshotInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSnapshotInstanceProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotInstanceProfilesOptions.Start)) - } - if listSnapshotInstanceProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotInstanceProfilesOptions.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_snapshot_instance_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotInstanceProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSubnetsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSubnetOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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()) - 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) (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) (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(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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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_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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVolumeProfilesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVolumeProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVolumesOptions.Headers { - 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.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - 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.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.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_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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVolumeOptions.Headers { - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVolumeOptions.Headers { - 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 -} - -// ListVolumeInstanceProfiles : List instance profiles compatible with a volume -// This request lists instance profiles compatible with a volume's -// `allowed_use.instance`, `operating_system.architecture` and -// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified volume must -// be bootable (have an `operating_system` property). -func (vpc *VpcV1) ListVolumeInstanceProfiles(listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumeInstanceProfilesWithContext(context.Background(), listVolumeInstanceProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVolumeInstanceProfilesWithContext is an alternate form of the ListVolumeInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeInstanceProfilesWithContext(ctx context.Context, listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listVolumeInstanceProfilesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}/instance_profiles`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeInstanceProfiles") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVolumeInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVolumeInstanceProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeInstanceProfilesOptions.Start)) - } - if listVolumeInstanceProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeInstanceProfilesOptions.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_instance_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeInstanceProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVpcsOptions.Headers { - 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 -} - -// 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. -// -// The system will automatically create the following additional resources for the VPC: -// - Unless `address_prefix_management` is `manual`, a [default address -// prefix](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-address-prefix) for each zone -// - A [default network -// ACL](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-network-acl) -// - A [default routing -// table](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-routing-table) -// - A [default security -// group](https://cloud.ibm.com/apidocs/vpc/latest#get-vpc-default-security-group). -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. -// -// For this request to succeed: -// - 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. All public -// address ranges attached to the VPC are automatically detached. -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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { - 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 -} - -// 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: -// - The VPC specified by the identifier in the URL must not already have a DNS resolution -// binding -// - The VPC specified by the identifier in the URL must have `dns.enable_hub` set to -// `false` -// - The updated DNS sharing connected topology must not contain more than one endpoint -// gateway with `allow_dns_resolution_binding` set to `true` targeting the same service. -// -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPCRoutesOptions.Headers { - 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 -} - -// 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 *CreateVPCRouteResponse, 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 *CreateVPCRouteResponse, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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, UnmarshalCreateVPCRouteResponse) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCRouteOptions.Headers { - 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 -} - -// 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 *GetVPCRouteResponse, 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 *GetVPCRouteResponse, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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, UnmarshalGetVPCRouteResponse) - 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 *UpdateVPCRouteResponse, 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 *UpdateVPCRouteResponse, 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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, UnmarshalUpdateVPCRouteResponse) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { - 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 -} - -// 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, "") - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listIkePoliciesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteIkePolicyOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// ListIkePolicyConnections : List VPN gateway connections that use a specified IKE policy -// This request lists VPN gateway connections that use an 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 *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(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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { - 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 { - err = core.SDKErrorf(err, "", "build-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, 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) - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy -// This request lists VPN gateway connections that use an 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 *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(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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { - 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 - } - - 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNGatewaysOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { - 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 { - err = core.SDKErrorf(err, "", "build-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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNServersOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPNServerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPNServerOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNServerClientsOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNServerClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range disconnectVPNClientOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { - 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 -} - -// 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range createVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { - 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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range getVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("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 -} - -// 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 - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "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 -} -func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "2025-08-26") -} - -// 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 address prefix. - CIDR *string `json:"cidr" validate:"required"` - - // The date and time that this address prefix was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Indicates whether subnets exist with addresses from this address 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 -// - BackupPolicyMatchResourceTypeShare -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" - BackupPolicyMatchResourceTypeShareConst = "share" - 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"` - - // A 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 []BackupPolicyTargetSnapshotIntf `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, UnmarshalBackupPolicyTargetSnapshot) - 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 *PageLink `json:"first" validate:"required"` - - // A page of jobs for the backup policy. - Jobs []BackupPolicyJob `json:"jobs" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) - if err != nil { - err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 -} - -// 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 -// - BackupPolicyJobSourceShareReference -type BackupPolicyJobSource struct { - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name,omitempty"` - - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// 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, UnmarshalDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct -type BackupPolicyJobStatusReason struct { - // A reason code for the status: - // - `internal_error`: Internal error (contact IBM support) - // - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable - // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state - // - `snapshot_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 - // size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) - // - `source_volume_unavailable`: The source volume is not attached to a running instance - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // A link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the BackupPolicyJobStatusReason.Code property. -// A reason code for the status: -// - `internal_error`: Internal error (contact IBM support) -// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable -// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state -// - `snapshot_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 -// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) -// - `source_volume_unavailable`: The source volume is not attached to a running instance -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" - BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - 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" - BackupPolicyJobStatusReasonCodeSourceVolumeUnavailableConst = "source_volume_unavailable" -) - -// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. -func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPatch : BackupPolicyPatch struct -type BackupPolicyPatch struct { - // The included content for backups created using this policy: - // - `boot_volume`: Include the instance's boot volume. - // - `data_volumes`: Include the instance's data volumes. - IncludedContent []string `json:"included_content,omitempty"` - - // The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching - // user tag and a matching type will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags,omitempty"` - - // The name for this backup policy. The name must not be used by another backup policy in the region. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the BackupPolicyPatch.IncludedContent property. -// An item to include. -const ( - BackupPolicyPatchIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyPatchIncludedContentDataVolumesConst = "data_volumes" -) - -// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPatch) - err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) - if err != nil { - err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BackupPolicyPatch -func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(backupPolicyPatch.IncludedContent) { - _patch["included_content"] = backupPolicyPatch.IncludedContent - } - if !core.IsNil(backupPolicyPatch.MatchUserTags) { - _patch["match_user_tags"] = backupPolicyPatch.MatchUserTags - } - if !core.IsNil(backupPolicyPatch.Name) { - _patch["name"] = backupPolicyPatch.Name - } - - return -} - -// BackupPolicyPlan : BackupPolicyPlan struct -type BackupPolicyPlan struct { - // Indicates whether the plan is active. - Active *bool `json:"active" validate:"required"` - - // The user tags to attach to backups (snapshots) created by this plan. - AttachUserTags []string `json:"attach_user_tags" validate:"required"` - - ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags" validate:"required"` - - // The date and time that the backup policy plan was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // 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 -} - -// asPatch returns a generic map representation of the BackupPolicyPlanClonePolicyPatch -func (backupPolicyPlanClonePolicyPatch *BackupPolicyPlanClonePolicyPatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(backupPolicyPlanClonePolicyPatch.MaxSnapshots) { - _patch["max_snapshots"] = backupPolicyPlanClonePolicyPatch.MaxSnapshots - } - if !core.IsNil(backupPolicyPlanClonePolicyPatch.Zones) { - var zonesPatches []map[string]interface{} - for _, zones := range backupPolicyPlanClonePolicyPatch.Zones { - zonesPatches = append(zonesPatches, zones.asPatch()) - } - _patch["zones"] = zonesPatches - } - - return -} - -// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct -type BackupPolicyPlanClonePolicyPrototype struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` - - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneIdentityIntf `json:"zones" validate:"required"` -} - -// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { - _model = &BackupPolicyPlanClonePolicyPrototype{ - Zones: zones, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicyPrototype) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) - if err != nil { - err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct -type BackupPolicyPlanCollection struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `json:"next,omitempty"` - - // A page of plans for the backup policy. - Plans []BackupPolicyPlan `json:"plans" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) - if err != nil { - err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct -type BackupPolicyPlanDeletionTrigger struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after" validate:"required"` - - // The maximum number of recent backups to keep. If absent, there is no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTrigger) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct -type BackupPolicyPlanDeletionTriggerPatch struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPatch) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the BackupPolicyPlanDeletionTriggerPatch -func (backupPolicyPlanDeletionTriggerPatch *BackupPolicyPlanDeletionTriggerPatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteAfter) { - _patch["delete_after"] = backupPolicyPlanDeletionTriggerPatch.DeleteAfter - } - if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteOverCount) { - _patch["delete_over_count"] = backupPolicyPlanDeletionTriggerPatch.DeleteOverCount - } - - return -} - -// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct -type BackupPolicyPlanDeletionTriggerPrototype struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. If unspecified, there will be no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPrototype) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct -type BackupPolicyPlanPatch struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` - - // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user - // tags for backups that have already been created by this plan. - AttachUserTags []string `json:"attach_user_tags,omitempty"` - - ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec,omitempty"` - - DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` - - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. - Name *string `json:"name,omitempty"` - - // The policies for additional backups in remote regions (replacing any existing policies). - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` -} - -// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BackupPolicyPlanPatch -func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(backupPolicyPlanPatch.Active) { - _patch["active"] = backupPolicyPlanPatch.Active - } - if !core.IsNil(backupPolicyPlanPatch.AttachUserTags) { - _patch["attach_user_tags"] = backupPolicyPlanPatch.AttachUserTags - } - if !core.IsNil(backupPolicyPlanPatch.ClonePolicy) { - _patch["clone_policy"] = backupPolicyPlanPatch.ClonePolicy.asPatch() - } - if !core.IsNil(backupPolicyPlanPatch.CopyUserTags) { - _patch["copy_user_tags"] = backupPolicyPlanPatch.CopyUserTags - } - if !core.IsNil(backupPolicyPlanPatch.CronSpec) { - _patch["cron_spec"] = backupPolicyPlanPatch.CronSpec - } - if !core.IsNil(backupPolicyPlanPatch.DeletionTrigger) { - _patch["deletion_trigger"] = backupPolicyPlanPatch.DeletionTrigger.asPatch() - } - if !core.IsNil(backupPolicyPlanPatch.Name) { - _patch["name"] = backupPolicyPlanPatch.Name - } - if !core.IsNil(backupPolicyPlanPatch.RemoteRegionPolicies) { - var remoteRegionPoliciesPatches []map[string]interface{} - for _, remoteRegionPolicies := range backupPolicyPlanPatch.RemoteRegionPolicies { - remoteRegionPoliciesPatches = append(remoteRegionPoliciesPatches, remoteRegionPolicies.asPatch()) - } - _patch["remote_region_policies"] = remoteRegionPoliciesPatches - } - - return -} - -// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct -type BackupPolicyPlanPrototype struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` - - // The user tags to attach to each backup (snapshot) created by this plan. - 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 *Deleted `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, 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, 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 -} - -// 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 -} - -// 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 -// - 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. - 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" - BackupPolicyPrototypeMatchResourceTypeShareConst = "share" - 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 -} - -// 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 - // 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"` - - // 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"` - - // 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 metadata service configuration for the bare metal server. - MetadataService *BareMetalServerMetadataService `json:"metadata_service" 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 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"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this bare metal server: - // - `deleting`: server is undergoing deletion - // - `failed`: server is failed and not usable (see `status_reasons`) - // - `maintenance`: server is undergoing maintenance (not usable) - // - `pending`: server is being provisioned and not yet usable - // - `reinitializing`: server is reinitializing and not yet usable - // - `restarting`: server is restarting and not yet usable - // - `running`: server is powered on - // - `starting`: server is starting and not yet usable - // - `stopped`: server is powered off - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Status *string `json:"status" validate:"required"` - - // 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.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 ( - 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 this bare metal server: -// - `deleting`: server is undergoing deletion -// - `failed`: server is failed and not usable (see `status_reasons`) -// - `maintenance`: server is undergoing maintenance (not usable) -// - `pending`: server is being provisioned and not yet usable -// - `reinitializing`: server is reinitializing and not yet usable -// - `restarting`: server is restarting and not yet usable -// - `running`: server is powered on -// - `starting`: server is starting and not yet usable -// - `stopped`: server is powered off -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerStatusDeletingConst = "deleting" - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusReinitializingConst = "reinitializing" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" -) - -// 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.UnmarshalModel(m, "firmware", &obj.Firmware, UnmarshalBareMetalServerFirmware) - if err != nil { - 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()) - 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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataService) - 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, 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, "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()) - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href,omitempty"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id,omitempty"` - - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the BareMetalServerBootTarget.ResourceType property. -// The resource type. -const ( - BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { - return true -} - -type BareMetalServerBootTargetIntf interface { - isaBareMetalServerBootTarget() bool -} - -// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. -func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerCpu : The bare metal server CPU configuration. -type BareMetalServerCpu struct { - // The CPU architecture. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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"` -} - -// Constants associated with the BareMetalServerCpu.Architecture property. -// The CPU architecture. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerCpuArchitectureAmd64Const = "amd64" - BareMetalServerCpuArchitectureS390xConst = "s390x" -) - -// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. -func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) - if err != nil { - err = core.SDKErrorf(err, "", "core_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) - if err != nil { - err = core.SDKErrorf(err, "", "threads_per_core-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerCollection : BareMetalServerCollection struct -type BareMetalServerCollection struct { - // A page of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - - // A link to the first page of resources. - First *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"` -} - -// 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, 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 *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 -} - -// 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 usage constraints to be matched against the requested bare metal server - // properties to determine compatibility. - // - // Only present for disks which are referenced in a bare metal server's `boot_target` - // property. The value of this property will be inherited from the source image at creation. - AllowedUse *BareMetalServerDiskAllowedUse `json:"allowed_use,omitempty"` - - // 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 attachment interface used: - // - `fcp`: Fiber Channel Protocol - // - `sata`: Serial Advanced Technology Attachment - // - `nvme`: Non-Volatile Memory Express - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The 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 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 ( - 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalBareMetalServerDiskAllowedUse) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_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, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - 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 -} - -// BareMetalServerDiskAllowedUse : BareMetalServerDiskAllowedUse struct -type BareMetalServerDiskAllowedUse struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query - // parameter value will be used. - ApiVersion *string `json:"api_version" validate:"required"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this disk. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server" validate:"required"` -} - -// UnmarshalBareMetalServerDiskAllowedUse unmarshals an instance of BareMetalServerDiskAllowedUse from the specified map of raw messages. -func UnmarshalBareMetalServerDiskAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskAllowedUse) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // The disks for the bare metal server. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` -} - -// 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) { - _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" - 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 -} - -// 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"` - - // A 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 default trusted profile configuration specified at bare metal server - // initialization. If absent, no default trusted profile was specified. - DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` - - // 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalBareMetalServerInitializationDefaultTrustedProfile) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "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 -} - -// BareMetalServerInitializationDefaultTrustedProfile : BareMetalServerInitializationDefaultTrustedProfile struct -type BareMetalServerInitializationDefaultTrustedProfile struct { - // If set to `true`, the system created a link to the specified `target` trusted profile during server initialization. - // Regardless of whether a link was created by the system or manually using the IAM Identity service, the link will be - // automatically deleted when the server is deleted. - AutoLink *bool `json:"auto_link" validate:"required"` - - // The default IAM trusted profile to use for this bare metal server. - Target *TrustedProfileReference `json:"target" validate:"required"` -} - -// UnmarshalBareMetalServerInitializationDefaultTrustedProfile unmarshals an instance of BareMetalServerInitializationDefaultTrustedProfile from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationDefaultTrustedProfile) - 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 -} - -// BareMetalServerInitializationDefaultTrustedProfilePrototype : BareMetalServerInitializationDefaultTrustedProfilePrototype struct -type BareMetalServerInitializationDefaultTrustedProfilePrototype struct { - // If set to `true`, the system will create a link to the specified `target` trusted profile during server 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 server is deleted. - AutoLink *bool `json:"auto_link,omitempty"` - - // The default IAM trusted profile to use for this bare metal server. - Target TrustedProfileIdentityIntf `json:"target" validate:"required"` -} - -// NewBareMetalServerInitializationDefaultTrustedProfilePrototype : Instantiate BareMetalServerInitializationDefaultTrustedProfilePrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerInitializationDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *BareMetalServerInitializationDefaultTrustedProfilePrototype, err error) { - _model = &BareMetalServerInitializationDefaultTrustedProfilePrototype{ - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype unmarshals an instance of BareMetalServerInitializationDefaultTrustedProfilePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationDefaultTrustedProfilePrototype) - 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 -} - -// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct -type BareMetalServerInitializationPrototype struct { - // The default trusted profile to be used when initializing the bare metal server. - // - // If unspecified, no default trusted profile will be made available. - DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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 bare metal server will be - // inaccessible unless the specified image provides another means of access. - Keys []KeyIdentityIntf `json:"keys" validate:"required"` - - // The 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalBareMetalServerInitializationDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "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 administrator 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"` - - // A 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 -} - -// BareMetalServerMetadataService : The metadata service configuration for the bare metal server. -type BareMetalServerMetadataService struct { - // Indicates whether the metadata service endpoint is available to the bare metal server. - 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"` -} - -// Constants associated with the BareMetalServerMetadataService.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 ( - BareMetalServerMetadataServiceProtocolHTTPConst = "http" - BareMetalServerMetadataServiceProtocolHTTPSConst = "https" -) - -// UnmarshalBareMetalServerMetadataService unmarshals an instance of BareMetalServerMetadataService from the specified map of raw messages. -func UnmarshalBareMetalServerMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerMetadataService) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerMetadataServicePatch : The metadata service configuration for the bare metal server. -type BareMetalServerMetadataServicePatch struct { - // Indicates whether the metadata service endpoint will be available to the bare metal server. - 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"` -} - -// Constants associated with the BareMetalServerMetadataServicePatch.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 ( - BareMetalServerMetadataServicePatchProtocolHTTPConst = "http" - BareMetalServerMetadataServicePatchProtocolHTTPSConst = "https" -) - -// UnmarshalBareMetalServerMetadataServicePatch unmarshals an instance of BareMetalServerMetadataServicePatch from the specified map of raw messages. -func UnmarshalBareMetalServerMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerMetadataServicePatch) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the BareMetalServerMetadataServicePatch -func (bareMetalServerMetadataServicePatch *BareMetalServerMetadataServicePatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(bareMetalServerMetadataServicePatch.Enabled) { - _patch["enabled"] = bareMetalServerMetadataServicePatch.Enabled - } - if !core.IsNil(bareMetalServerMetadataServicePatch.Protocol) { - _patch["protocol"] = bareMetalServerMetadataServicePatch.Protocol - } - - return -} - -// BareMetalServerMetadataServicePrototype : The metadata service configuration for the bare metal server. -type BareMetalServerMetadataServicePrototype struct { - // Indicates whether the metadata service endpoint will be available to the bare metal server. - 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"` -} - -// Constants associated with the BareMetalServerMetadataServicePrototype.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 ( - BareMetalServerMetadataServicePrototypeProtocolHTTPConst = "http" - BareMetalServerMetadataServicePrototypeProtocolHTTPSConst = "https" -) - -// UnmarshalBareMetalServerMetadataServicePrototype unmarshals an instance of BareMetalServerMetadataServicePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerMetadataServicePrototype) - 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 - } - 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. - // - // 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. - 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" -) - -func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { - return true -} - -type BareMetalServerNetworkAttachmentIntf interface { - isaBareMetalServerNetworkAttachment() bool -} - -// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachment) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // The network attachments for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `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, 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, "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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(bareMetalServerNetworkAttachmentPatch.AllowedVlans) { - _patch["allowed_vlans"] = bareMetalServerNetworkAttachmentPatch.AllowedVlans - } - if !core.IsNil(bareMetalServerNetworkAttachmentPatch.Name) { - _patch["name"] = bareMetalServerNetworkAttachmentPatch.Name - } - - 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"` - - // The 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 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"` - - // 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"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property. -// The protocol state filtering mode to use for this virtual network interface. If -// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` -// resource type: -// -// - `bare_metal_server_network_attachment`: disabled -// - `instance_network_attachment`: enabled -// - `share_mount_target`: enabled -// -// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any -// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering -// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. -const ( - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" -) - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { - isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) - return - } - err = core.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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - 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 *Deleted `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"` - - // 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. -// 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, 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, "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.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 -} - -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByHiperSocket -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on - // the attached virtual network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - // - // If this bare metal server has network attachments, this network interface was created as a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding - // network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on - // the attached virtual network interface. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the floating IPs are associated - // with the attached virtual network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the identifier is that of the - // corresponding network attachment. - ID *string `json:"id" validate:"required"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1Q tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1Q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the interface type is that of the - // corresponding network attachment. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be empty. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the - // attached virtual network interface. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding - // network attachment. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the port speed is that of its - // corresponding network attachment. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of this bare metal server network interface. - 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // The network interfaces for the bare metal server. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, 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, "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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowIPSpoofing) { - _patch["allow_ip_spoofing"] = bareMetalServerNetworkInterfacePatch.AllowIPSpoofing - } - if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowedVlans) { - _patch["allowed_vlans"] = bareMetalServerNetworkInterfacePatch.AllowedVlans - } - if !core.IsNil(bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat) { - _patch["enable_infrastructure_nat"] = bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat - } - if !core.IsNil(bareMetalServerNetworkInterfacePatch.Name) { - _patch["name"] = bareMetalServerNetworkInterfacePatch.Name - } - - return -} - -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct -// Models which "extend" this model: -// - 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 -} - -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified - // value must match one of the bandwidth values in the bare metal server's profile. - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server - // will fail to boot. - // - // For `enable_secure_boot` to be changed, the bare metal server `status` must be - // `stopped`. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - // The metadata service configuration for the bare metal server. - MetadataService *BareMetalServerMetadataServicePatch `json:"metadata_service,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"` - - ReservationAffinity *BareMetalServerReservationAffinityPatch `json:"reservation_affinity,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` -} - -// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. -func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPatch) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "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, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePatch) - 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, "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()) - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(bareMetalServerPatch.Bandwidth) { - _patch["bandwidth"] = bareMetalServerPatch.Bandwidth - } - if !core.IsNil(bareMetalServerPatch.EnableSecureBoot) { - _patch["enable_secure_boot"] = bareMetalServerPatch.EnableSecureBoot - } - if !core.IsNil(bareMetalServerPatch.MetadataService) { - _patch["metadata_service"] = bareMetalServerPatch.MetadataService.asPatch() - } - 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() - } - - 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"` - - // 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"` - - ReservationTerms *BareMetalServerProfileReservationTerms `json:"reservation_terms" 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.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()) - 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 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" -) - -// Constants associated with the BareMetalServerProfileCpuArchitecture.Value property. -// The CPU architecture for a bare metal server with this profile. -const ( - BareMetalServerProfileCpuArchitectureValueAmd64Const = "amd64" - BareMetalServerProfileCpuArchitectureValueS390xConst = "s390x" -) - -// 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, "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 -} - -// 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. - 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 metadata service configuration for the bare metal server. - MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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 [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"` - - 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"` - - 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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) - 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, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - 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()) - 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 -} - -// 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. - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` - - // A 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_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" - 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. -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, "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 -} - -// ClusterNetwork : ClusterNetwork struct -type ClusterNetwork struct { - // The date and time that the cluster network was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this cluster network. - CRN *string `json:"crn" validate:"required"` - - // The URL for this cluster network. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this cluster network. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []ClusterNetworkLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the cluster network. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this cluster network. The name must not be used by another cluster network in the region. - Name *string `json:"name" validate:"required"` - - // The profile for this cluster network. - Profile *ClusterNetworkProfileReference `json:"profile" validate:"required"` - - // The resource group for this cluster network. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The IP address ranges available for subnets for this cluster network. - SubnetPrefixes []ClusterNetworkSubnetPrefix `json:"subnet_prefixes" 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 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 ( - ClusterNetworkResourceTypeClusterNetworkConst = "cluster_network" -) - -// 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, "", "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, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkLifecycleReason) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalClusterNetworkProfileReference) - 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, "subnet_prefixes", &obj.SubnetPrefixes, UnmarshalClusterNetworkSubnetPrefix) - if err != nil { - err = core.SDKErrorf(err, "", "subnet_prefixes-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 -} - -// ClusterNetworkCollection : ClusterNetworkCollection struct -type ClusterNetworkCollection struct { - // A page of cluster networks. - ClusterNetworks []ClusterNetwork `json:"cluster_networks" validate:"required"` - - // A link to the first page of resources. - First *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"` -} - -// 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, "", "cluster_networks-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 *ClusterNetworkCollection) 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 -} - -// 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"` - - // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the cluster network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The URL for this cluster network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this cluster network interface. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []ClusterNetworkInterfaceLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the cluster network interface. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The MAC address of the cluster network interface. May be absent if - // `lifecycle_state` is `pending`. - MacAddress *string `json:"mac_address,omitempty"` - - // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. - Name *string `json:"name" validate:"required"` - - // The cluster network subnet reserved IP for this cluster network interface. - PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *ClusterNetworkSubnetReference `json:"subnet,omitempty"` - - // The target of this cluster network interface. - // - // If 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 ClusterNetworkInterface.LifecycleState property. -// The lifecycle state of the cluster network interface. -const ( - ClusterNetworkInterfaceLifecycleStateDeletingConst = "deleting" - ClusterNetworkInterfaceLifecycleStateFailedConst = "failed" - ClusterNetworkInterfaceLifecycleStatePendingConst = "pending" - ClusterNetworkInterfaceLifecycleStateStableConst = "stable" - ClusterNetworkInterfaceLifecycleStateSuspendedConst = "suspended" - ClusterNetworkInterfaceLifecycleStateUpdatingConst = "updating" - ClusterNetworkInterfaceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the ClusterNetworkInterface.ResourceType property. -// The resource type. -const ( - ClusterNetworkInterfaceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" -) - -// UnmarshalClusterNetworkInterface unmarshals an instance of ClusterNetworkInterface from the specified map of raw messages. -func UnmarshalClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "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, "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, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkInterfaceLifecycleReason) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) - if err != nil { - err = core.SDKErrorf(err, "", "mac_address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkInterfaceTarget) - 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 -} - -// ClusterNetworkInterfaceCollection : ClusterNetworkInterfaceCollection struct -type ClusterNetworkInterfaceCollection struct { - // A link to the first page of resources. - 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 *PageLink `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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.UnmarshalModel(m, "interfaces", &obj.Interfaces, UnmarshalClusterNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "interfaces-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 *ClusterNetworkInterfaceCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// 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"` - - // A link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// 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, "", "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 -} - -// ClusterNetworkInterfacePatch : ClusterNetworkInterfacePatch struct -type ClusterNetworkInterfacePatch struct { - // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. Must be - // `false` if the cluster network interface is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this cluster network interface. The name must not be used by another interface in the cluster network. - // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalClusterNetworkInterfacePatch unmarshals an instance of ClusterNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalClusterNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - err = core.SDKErrorf(err, "", "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 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 - } - - return -} - -// 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"` -} - -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, "", "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 -} - -// ClusterNetworkInterfaceReference : The associated cluster network subnet. -type ClusterNetworkInterfaceReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this 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 primary IP for this cluster network interface. - PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *ClusterNetworkSubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the ClusterNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - ClusterNetworkInterfaceReferenceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" -) - -// 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, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - 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, UnmarshalClusterNetworkSubnetReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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: -// - ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext -type ClusterNetworkInterfaceTarget struct { - // The URL for this instance cluster network attachment. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance cluster network attachment. - ID *string `json:"id,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 resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ClusterNetworkInterfaceTarget.ResourceType property. -// The resource type. -const ( - ClusterNetworkInterfaceTargetResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" -) - -func (*ClusterNetworkInterfaceTarget) isaClusterNetworkInterfaceTarget() bool { - return true -} - -type ClusterNetworkInterfaceTargetIntf interface { - isaClusterNetworkInterfaceTarget() bool -} - -// 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, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - 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 -} - -// ClusterNetworkLifecycleReason : ClusterNetworkLifecycleReason struct -type ClusterNetworkLifecycleReason struct { - // A reason code for this lifecycle state: - // - `internal_error`: internal error (contact IBM support) - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // A link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// 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 ( - ClusterNetworkLifecycleReasonCodeInternalErrorConst = "internal_error" - ClusterNetworkLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// 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, "", "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 -} - -// 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"` -} - -// 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 - } - - return -} - -// 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 URL for this cluster network profile. - Href *string `json:"href" validate:"required"` - - // 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"` - - // 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 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 ( - ClusterNetworkProfileFamilyVelaConst = "vela" -) - -// Constants associated with the ClusterNetworkProfile.ResourceType property. -// The resource type. -const ( - ClusterNetworkProfileResourceTypeClusterNetworkProfileConst = "cluster_network_profile" -) - -// 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, "", "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, "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, "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 -} - -// ClusterNetworkProfileCollection : ClusterNetworkProfileCollection struct -type ClusterNetworkProfileCollection 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 cluster network profiles. - Profiles []ClusterNetworkProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalClusterNetworkProfileCollection unmarshals an instance of ClusterNetworkProfileCollection from the specified map of raw messages. -func UnmarshalClusterNetworkProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - 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, UnmarshalClusterNetworkProfile) - 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 *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 URL for this cluster network profile. - Href *string `json:"href,omitempty"` -} - -func (*ClusterNetworkProfileIdentity) isaClusterNetworkProfileIdentity() bool { - return true -} - -type ClusterNetworkProfileIdentityIntf interface { - isaClusterNetworkProfileIdentity() bool -} - -// 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, "", "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 -} - -// ClusterNetworkProfileReference : ClusterNetworkProfileReference struct -type ClusterNetworkProfileReference struct { - // The URL for this cluster network profile. - Href *string `json:"href" validate:"required"` - - // 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 ClusterNetworkProfileReference.ResourceType property. -// The resource type. -const ( - ClusterNetworkProfileReferenceResourceTypeClusterNetworkProfileConst = "cluster_network_profile" -) - -// UnmarshalClusterNetworkProfileReference unmarshals an instance of ClusterNetworkProfileReference from the specified map of raw messages. -func UnmarshalClusterNetworkProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "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 -} - -// ClusterNetworkReference : ClusterNetworkReference struct -type ClusterNetworkReference struct { - // The CRN for this cluster network. - 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 cluster network. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this cluster network. - ID *string `json:"id" validate:"required"` - - // The name for this cluster network. The name must not be used by another cluster network in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ClusterNetworkReference.ResourceType property. -// The resource type. -const ( - ClusterNetworkReferenceResourceTypeClusterNetworkConst = "cluster_network" -) - -// 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, "", "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 -} - -// 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 date and time that the cluster network subnet was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this cluster network subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this cluster network subnet. - ID *string `json:"id" validate:"required"` - - // The IP version for this cluster network subnet. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - IPVersion *string `json:"ip_version" validate:"required"` - - // The IPv4 range of this cluster network subnet, expressed in CIDR format. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []ClusterNetworkSubnetLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the cluster network subnet. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster - // network. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The total number of IPv4 addresses in this cluster network subnet. - // - // Note: This is calculated as 2(32 - prefix length). For example, the prefix length `/24` gives:
- // 2(32 - 24) = 28 = 256 addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` -} - -// Constants associated with the 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" -) - -// 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, "", "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, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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, "", "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, "subnets", &obj.Subnets, UnmarshalClusterNetworkSubnet) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ClusterNetworkSubnetCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// ClusterNetworkSubnetIdentity : Identifies a cluster network subnet by a unique property. -// Models which "extend" this model: -// - 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.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // A link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// 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 ( - ClusterNetworkSubnetLifecycleReasonCodeInternalErrorConst = "internal_error" - ClusterNetworkSubnetLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// 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()) - 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 -} - -// ClusterNetworkSubnetPatch : ClusterNetworkSubnetPatch struct -type ClusterNetworkSubnetPatch struct { - // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster - // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalClusterNetworkSubnetPatch unmarshals an instance of ClusterNetworkSubnetPatch from the specified map of raw messages. -func UnmarshalClusterNetworkSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkSubnetPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 -} - -// 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 ( - ClusterNetworkSubnetPrefixAllocationPolicyAutoConst = "auto" -) - -// 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, "", "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 -} - -// ClusterNetworkSubnetPrefixPrototype : ClusterNetworkSubnetPrefixPrototype struct -type ClusterNetworkSubnetPrefixPrototype struct { - // The IPv4 range of the cluster network's subnet prefix, expressed in CIDR format. - // - // The CIDR prefix length must be less than `/29` (at least 8 addresses). - // - // If a range is specified that overlaps with address prefixes in the cluster network's VPC, the operating systems of - // any virtual server instances attaching to this cluster network must be [configured to avoid - // conflicts](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-cluster-network#advanced-consideration). - CIDR *string `json:"cidr,omitempty"` -} - -// UnmarshalClusterNetworkSubnetPrefixPrototype unmarshals an instance of ClusterNetworkSubnetPrefixPrototype from the specified map of raw messages. -func UnmarshalClusterNetworkSubnetPrefixPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkSubnetPrefixPrototype) - err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) - if err != nil { - err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ClusterNetworkSubnetPrototype : ClusterNetworkSubnetPrototype struct -// Models which "extend" this model: -// - 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"` -} - -// 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 ClusterNetworkSubnetPrototypeIntf interface { - isaClusterNetworkSubnetPrototype() bool -} - -// 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, "", "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 -} - -// ClusterNetworkSubnetReference : ClusterNetworkSubnetReference struct -type ClusterNetworkSubnetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this cluster network subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this cluster network subnet. - ID *string `json:"id" validate:"required"` - - // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster - // network. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the 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, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - 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 -} - -// 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"` - - // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` - // is deleted, or the cluster network subnet reserved IP is unbound. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The 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"` -} - -// 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, "", "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 -} - -// ClusterNetworkSubnetReservedIPCollection : ClusterNetworkSubnetReservedIPCollection struct -type ClusterNetworkSubnetReservedIPCollection struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `json:"next,omitempty"` - - // A page of reserved IPs for the cluster network subnet. - ReservedIps []ClusterNetworkSubnetReservedIP `json:"reserved_ips" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalClusterNetworkSubnetReservedIPCollection unmarshals an instance of ClusterNetworkSubnetReservedIPCollection from the specified map of raw messages. -func UnmarshalClusterNetworkSubnetReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterNetworkSubnetReservedIPCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "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, "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 -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ClusterNetworkSubnetReservedIPCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// ClusterNetworkSubnetReservedIPLifecycleReason : ClusterNetworkSubnetReservedIPLifecycleReason struct -type ClusterNetworkSubnetReservedIPLifecycleReason struct { - // A reason code for this lifecycle state: - // - `internal_error`: internal error (contact IBM support) - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // A link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// 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, "", "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 -} - -// 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"` -} - -// 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, "", "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 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 - } - - return -} - -// 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"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this cluster network subnet 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 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 resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ClusterNetworkSubnetReservedIPReference.ResourceType property. -// The resource type. -const ( - ClusterNetworkSubnetReservedIPReferenceResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip" -) - -// 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 -} - -// 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"` - - // The URL for this cluster network interface. - Href *string `json:"href,omitempty"` - - // The unique identifier for this cluster network interface. - ID *string `json:"id,omitempty"` - - // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ClusterNetworkSubnetReservedIPTarget.ResourceType property. -// The resource type. -const ( - ClusterNetworkSubnetReservedIPTargetResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" -) - -func (*ClusterNetworkSubnetReservedIPTarget) isaClusterNetworkSubnetReservedIPTarget() bool { - return true -} - -type ClusterNetworkSubnetReservedIPTargetIntf interface { - isaClusterNetworkSubnetReservedIPTarget() bool -} - -// 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, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - 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 -} - -// 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"` - - // The user tags to attach to each backup (snapshot) created by this plan. - 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 -} - -// 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. - 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. The target: - // - Must not already be the target of another endpoint gateway in the VPC - // - Must not have a service endpoint that overlaps with any `service_endpoints` of - // another endpoint gateway in the VPC. - // - // If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint - // gateway with `allow_dns_resolution_binding` set to `true` in the [DNS - // sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that: - // - Has the same `target` as this endpoint gateway - // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint - // gateway. - 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`. - // - // If `true`, then there must not be another endpoint gateway with - // `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected - // topology that: - // - Has the same `target` as this endpoint gateway - // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint - // gateway. - // - // 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 { - // The instance template to use when creating new instances. - // - // The specified template must not have `default_trusted_profile.auto_link` set to `true`. - 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="` - - // 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. - 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` - // - // 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` - // - // The `triple_des` algorithm has been deprecated. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // 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. - 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` -// -// The `md5` and `sha1` algorithms have been deprecated. -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` -// -// The `triple_des` algorithm has been deprecated. -const ( - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// The Perfect Forward Secrecy group. -// -// 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" - 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 { - // 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` 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"` - - // 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 for 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 for 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 non-overlapping port range 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 concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. - // - // Supported for load balancers in the `application` family. - // - // If unspecified, the limit will be `15000` 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 - // 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. - // - // If unspecified, the timeout will be `50` 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. Each listener in the load balancer must have a non-overlapping port range and `protocol` - // combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. - // - // If `port_min` is also specified, `port` must have the same value as `port_min`. - 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`. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `65535`. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. Protocol values of `tcp`, `http` and - // `https` share the TCP port space. - 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`. - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified. - // - // If `port` is also specified, `port_min` must have the same value as `port`. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `1`. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. Protocol values of `tcp`, `http` and - // `https` share the TCP port space. - 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 non-overlapping port range 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_to_listener`: Requests will be forwarded to the specified - // `target` listener. - // - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. - // - `https_redirect`: Requests will be redirected to the specified `target.listener`. - // This listener must have a `protocol` of `http`, and the target listener must - // have a `protocol` of `https`. - // - `redirect`: Requests will be redirected to the specified `target.url` - // - `reject`: Requests will be rejected with a `403` status code. - Action *string `json:"action" validate:"required"` - - // The 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this - // load balancer to forward to. - // - If `action` is `forward_to_pool`, 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. - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. -// The policy action: -// - `forward_to_listener`: Requests will be forwarded to the specified -// `target` listener. -// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. -// - `https_redirect`: Requests will be redirected to the specified `target.listener`. -// This listener must have a `protocol` of `http`, and the target listener must -// have a `protocol` of `https`. -// - `redirect`: Requests will be redirected to the specified `target.url` -// - `reject`: Requests will be rejected with a `403` status code. -const ( - CreateLoadBalancerListenerPolicyOptionsActionForwardToListenerConst = "forward_to_listener" - CreateLoadBalancerListenerPolicyOptionsActionForwardToPoolConst = "forward_to_pool" - 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 for the rule. - Condition *string `json:"condition" validate:"required"` - - // The content the rule applies to: - // - `body`: The UTF-8 form-encoded HTTP request body - // - `header`: The HTTP header - // - `hostname`: The fully-qualified domain name of the server specified in the Host - // HTTP request header - // - `path`: The path of the HTTP request - // - `query`: The query of the HTTP request URL - // - `sni_hostname`: The fully-qualified domain name of the server provided in the - // "server name indicator" extension during TLS negotiation - // - // - For listeners with `protocol` `http` or `https`, any type may be specified. - // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. - Type *string `json:"type" validate:"required"` - - // 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 to match for this rule. - // - If the `type` is `header`, this property must be specified. - // - If the `type` is `body` or `query`, this property may be specified. - // - For all other types, this property must not be specified. - 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 for the rule. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" - CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" - CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. -// The content the rule applies to: -// - `body`: The UTF-8 form-encoded HTTP request body -// - `header`: The HTTP header -// - `hostname`: The fully-qualified domain name of the server specified in the Host -// HTTP request header -// - `path`: The path of the HTTP request -// - `query`: The query of the HTTP request URL -// - `sni_hostname`: The fully-qualified domain name of the server provided in the -// "server name indicator" extension during TLS negotiation -// -// - For listeners with `protocol` `http` or `https`, any type may be specified. -// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" - CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" - CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" - CreateLoadBalancerListenerPolicyRuleOptionsTypeSniHostnameConst = "sni_hostname" -) - -// 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 set to `true`, 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. - // - 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"` - - // 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`. - // - // 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"` - - // 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 []LoadBalancerPoolPrototypeLoadBalancerContext `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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 -} - -// 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 - 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 []LoadBalancerPoolPrototypeLoadBalancerContext) *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. - // - // 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. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. - // - // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load - // balancer has a subnet in. - // - // 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. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // The weight of the member. - // - // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` - // family. - // - // If unspecified, the weight will be `50` for load balancers in the `application` family. - 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. 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. - // - // If this pool has a member targeting a load balancer then: - // - // - If the targeted load balancer has multiple subnets, this health monitor will be - // used to direct traffic to the available subnets. - // - The health checks spawned by this health monitor will be handled as any other - // traffic (that is, subject to the configuration of listeners and pools on the target - // load balancer). - // - This health monitor does not affect how pool member health is determined within the - // target load balancer. - // - // For more information, see [Private Path network load balancer frequently asked - // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). - HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `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 failsafe policy to use for this pool. - // - // If unspecified, the default failsafe policy action from the profile will be used. - FailsafePolicy *LoadBalancerPoolFailsafePolicyPrototype `json:"failsafe_policy,omitempty"` - - // 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 - // - // 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 - // `source_ip_session_persistence_supported` set to `true` in its profile. - // - // If unspecified, session persistence will be disabled, and traffic will be distributed - // across 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. 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" - 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 -// -// For load balancers in the `network` family, this property must be `disabled`. -const ( - CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" - CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" - CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" -) - -// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions -func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, 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 LoadBalancerPoolHealthMonitorPrototypeIntf) *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 -} - -// SetFailsafePolicy : Allow user to set FailsafePolicy -func (_options *CreateLoadBalancerPoolOptions) SetFailsafePolicy(failsafePolicy *LoadBalancerPoolFailsafePolicyPrototype) *CreateLoadBalancerPoolOptions { - _options.FailsafePolicy = failsafePolicy - 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. - 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. -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 -} - -// 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 -} - -// CreatePublicAddressRangeOptions : The CreatePublicAddressRange options. -type CreatePublicAddressRangeOptions struct { - // The total number of public IPv4 addresses required. Must be a power of 2. - Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"` - - // The name for this public address range. The name must not be used by another public address range 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 target to bind this public address range to. If unspecified, the public address - // range will not be bound to a target at creation. - Target *PublicAddressRangeTargetPrototype `json:"target,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreatePublicAddressRangeOptions : Instantiate CreatePublicAddressRangeOptions -func (*VpcV1) NewCreatePublicAddressRangeOptions(ipv4AddressCount int64) *CreatePublicAddressRangeOptions { - return &CreatePublicAddressRangeOptions{ - Ipv4AddressCount: core.Int64Ptr(ipv4AddressCount), - } -} - -// SetIpv4AddressCount : Allow user to set Ipv4AddressCount -func (_options *CreatePublicAddressRangeOptions) SetIpv4AddressCount(ipv4AddressCount int64) *CreatePublicAddressRangeOptions { - _options.Ipv4AddressCount = core.Int64Ptr(ipv4AddressCount) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreatePublicAddressRangeOptions) SetName(name string) *CreatePublicAddressRangeOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreatePublicAddressRangeOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicAddressRangeOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreatePublicAddressRangeOptions) SetTarget(target *PublicAddressRangeTargetPrototype) *CreatePublicAddressRangeOptions { - _options.Target = target - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePublicAddressRangeOptions) SetHeaders(param map[string]string) *CreatePublicAddressRangeOptions { - 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 [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"` - - // 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: -// - `automatic`: The reservation will be automatically selected -// - `restricted`: The reservation must be manually requested. -const ( - CreateReservationOptionsAffinityPolicyAutomaticConst = "automatic" - 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 no traffic being allowed. - 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 -} - -// 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. - 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 -} - -// CreateVPCRouteResponse : CreateVPCRouteResponse struct -type CreateVPCRouteResponse struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Action *string `json:"action" validate:"required"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin" validate:"required"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. - // - // If subnets are attached to the route's routing table, egress traffic from those - // subnets in this zone will be subject to this route. If this route's routing table - // has any of `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic - // from those ingress sources arriving in this zone will be subject to this route. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the CreateVPCRouteResponse.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - CreateVPCRouteResponseActionDelegateConst = "delegate" - CreateVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" - CreateVPCRouteResponseActionDeliverConst = "deliver" - CreateVPCRouteResponseActionDropConst = "drop" -) - -// Constants associated with the CreateVPCRouteResponse.LifecycleState property. -// The lifecycle state of the route. -const ( - CreateVPCRouteResponseLifecycleStateDeletingConst = "deleting" - CreateVPCRouteResponseLifecycleStateFailedConst = "failed" - CreateVPCRouteResponseLifecycleStatePendingConst = "pending" - CreateVPCRouteResponseLifecycleStateStableConst = "stable" - CreateVPCRouteResponseLifecycleStateSuspendedConst = "suspended" - CreateVPCRouteResponseLifecycleStateUpdatingConst = "updating" - CreateVPCRouteResponseLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the CreateVPCRouteResponse.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 ( - CreateVPCRouteResponseOriginServiceConst = "service" - CreateVPCRouteResponseOriginUserConst = "user" -) - -// UnmarshalCreateVPCRouteResponse unmarshals an instance of CreateVPCRouteResponse from the specified map of raw messages. -func UnmarshalCreateVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateVPCRouteResponse) - 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 -} - -// 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"` - - // The 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 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"` - - // 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 -} - -// 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{} -} - -// 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 -} - -// 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 - 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="` - - // The VPC to bind this VPC to for DNS resolution. The VPC must be different from the VPC - // specified in the URL, 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. - // - // Setting this property to `true` is supported only for accounts that have been - // [granted approval](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure). Instead, - // use a [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to connect this VPC to Classic Infrastructure. - // 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. - // - // 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 -// 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 -} - -// 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 (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. - NextHop RouteNextHopPrototypeIntf `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 RouteNextHopPrototypeIntf) *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. - // - // 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 - // 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 (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. - NextHop RouteNextHopPrototypeIntf `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 RouteNextHopPrototypeIntf) *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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - CRN *string `json:"crn" validate:"required"` -} - -// 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()) - 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 DNS server IPv4 address. - Address *string `json:"address,omitempty"` - - // If specified, DHCP configuration for the specified zone will have this DNS server listed - // first. - ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` -} - -// 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 -} - -// 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 -type DnsZoneIdentity struct { - ID *string `json:"id,omitempty"` -} - -func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { - return true -} - -type DnsZoneIdentityIntf interface { - isaDnsZoneIdentity() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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"` -} - -// 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"` - - // The disks for the dedicated host. - 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 { - // A page of dedicated hosts. - DedicatedHosts []DedicatedHost `json:"dedicated_hosts" 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"` -} - -// 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, 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 *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 -} - -// 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"` - - // The instance disks that are on this dedicated host disk. - InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` - - // The disk interface used for attaching the disk. - 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. - // - // 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. -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 { - // The disks for the dedicated host. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(dedicatedHostDiskPatch.Name) { - _patch["name"] = dedicatedHostDiskPatch.Name - } - - 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(dedicatedHostGroupPatch.Name) { - _patch["name"] = dedicatedHostGroupPatch.Name - } - - 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 *Deleted `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, 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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(dedicatedHostPatch.InstancePlacementEnabled) { - _patch["instance_placement_enabled"] = dedicatedHostPatch.InstancePlacementEnabled - } - if !core.IsNil(dedicatedHostPatch.Name) { - _patch["name"] = dedicatedHostPatch.Name - } - - return -} - -// DedicatedHostProfile : DedicatedHostProfile struct -type DedicatedHostProfile struct { - // The product class this dedicated host profile belongs to. - Class *string `json:"class" validate:"required"` - - // The disks for a dedicated host with this profile. - 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 *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 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, 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, 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 -} - -// 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" -) - -// Constants associated with the DedicatedHostProfileVcpuArchitecture.Value property. -// The VCPU architecture for a dedicated host with this profile. -const ( - DedicatedHostProfileVcpuArchitectureValueAmd64Const = "amd64" - DedicatedHostProfileVcpuArchitectureValueS390xConst = "s390x" -) - -// 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" -) - -// Constants associated with the DedicatedHostProfileVcpuManufacturer.Value property. -// The VCPU manufacturer for a dedicated host with this profile. -const ( - DedicatedHostProfileVcpuManufacturerValueAmdConst = "amd" - DedicatedHostProfileVcpuManufacturerValueIBMConst = "ibm" - DedicatedHostProfileVcpuManufacturerValueIntelConst = "intel" -) - -// 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 *Deleted `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, 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 -} - -// 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. Created with: - // - The first rule, named `allow-inbound`, allowing ICMP, TCP and UDP inbound traffic. - // - The second rule, named `allow-outbound`, allowing ICMP, TCP, and UDP outbound - // traffic. - // - // 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. - // - // Created with filters allowing `vpn_gateway` and `vpn_server` resources to create routes, but filters may be added or - // removed with subsequent requests. - // - // 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 - // 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 CRN for this VPC routing table. - CRN *string `json:"crn" 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 group for this routing table. - ResourceGroup *ResourceGroupReference `json:"resource_group" 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. - // - // Set to `false` at VPC creation, but may be updated with subsequent requests. - // - // 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. - // - // Set to `false` at VPC creation, but may be updated with subsequent requests. - // - // 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. - // - // Set to `false` at VPC creation, but may be updated with subsequent requests. - // - // 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. - // - // Set to `false` at VPC creation, but may be updated with subsequent requests. - // - // 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, "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, "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.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_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 CRN for this security group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this security group. - 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. Created with: - // - A rule allowing inbound ICMP, TCP and UDP traffic from other interfaces in the - // VPC's default security group - // - A rule allowing outbound ICMP, TCP and UDP traffic to any destination - // - // 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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// 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 -} - -// DeletePublicAddressRangeOptions : The DeletePublicAddressRange options. -type DeletePublicAddressRangeOptions struct { - // The public address range identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewDeletePublicAddressRangeOptions : Instantiate DeletePublicAddressRangeOptions -func (*VpcV1) NewDeletePublicAddressRangeOptions(id string) *DeletePublicAddressRangeOptions { - return &DeletePublicAddressRangeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeletePublicAddressRangeOptions) SetID(id string) *DeletePublicAddressRangeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeletePublicAddressRangeOptions) SetHeaders(param map[string]string) *DeletePublicAddressRangeOptions { - 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 -} - -// 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. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The file 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 -} - -// 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. - 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 -} - -// Deleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type Deleted struct { - // A 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 -} - -// 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 API maturity. For the API behavior documented here, specify `beta`. - Maturity *string `json:"maturity" validate:"required"` - - // 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(maturity string, id string) *DeprecateImageOptions { - return &DeprecateImageOptions{ - Maturity: core.StringPtr(maturity), - ID: core.StringPtr(id), - } -} - -// SetMaturity : Allow user to set Maturity -func (_options *DeprecateImageOptions) SetMaturity(maturity string) *DeprecateImageOptions { - _options.Maturity = core.StringPtr(maturity) - return _options -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 - // 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. 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. A domain name may have a wildcard prefix. - 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 { - // A page of endpoint gateways. - EndpointGateways []EndpointGateway `json:"endpoint_gateways" 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"` -} - -// 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, 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 *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 -} - -// 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 - // 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"` - - // A 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: -// - `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 -// support) -// -// 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" -) - -// 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`. - // - // If `true`, then there must not be another endpoint gateway with - // `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected - // topology that: - // - Has the same `target` as this endpoint gateway - // - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint - // gateway. - // - // 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) { - _patch = map[string]interface{}{} - if !core.IsNil(endpointGatewayPatch.AllowDnsResolutionBinding) { - _patch["allow_dns_resolution_binding"] = endpointGatewayPatch.AllowDnsResolutionBinding - } - if !core.IsNil(endpointGatewayPatch.Name) { - _patch["name"] = endpointGatewayPatch.Name - } - - 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: -// - EndpointGatewayTargetPrivatePathServiceGatewayReference -// - 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"` - - // 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,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"` -} - -// Constants associated with the EndpointGatewayTarget.ResourceType property. -// The target resource type for this endpoint gateway. -const ( - EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" - EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_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, "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, "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, UnmarshalPrivatePathServiceGatewayRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 overlaps with any `service_endpoints` of -// another endpoint gateway in the VPC. -// -// If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint gateway with -// `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected -// topology that: -// - Has the same `target` as this endpoint gateway -// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint -// gateway. -// -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype -// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype -// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype -type EndpointGatewayTargetPrototype struct { - // 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"` -} - -// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. -// The target resource type for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" - 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) { - obj := new(EndpointGatewayTargetPrototype) - 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.UnmarshalPrimitive(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 -} - -// 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. - // - // 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. - 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. -// -// 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" - 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct -type FloatingIPCollectionVirtualNetworkInterfaceContext struct { - // A link to the first page of resources. - 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"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(floatingIPPatch.Name) { - _patch["name"] = floatingIPPatch.Name - } - if !core.IsNil(floatingIPPatch.Target) { - _patch["target"] = floatingIPPatch.Target.asPatch() - } - - 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 *Deleted `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, 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 - } - 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 *Deleted `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 primary IP address of this instance network interface. - 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, 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, "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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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: -// -// - 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 { - // The 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 *PageLink `json:"first" validate:"required"` - - // 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. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(flowLogCollectorPatch.Active) { - _patch["active"] = flowLogCollectorPatch.Active - } - if !core.IsNil(flowLogCollectorPatch.Name) { - _patch["name"] = flowLogCollectorPatch.Name - } - - 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 *Deleted `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"` - - // The virtual network interface for this instance network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,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, 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 - } - 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 - } - 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 -} - -// 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 -} - -// 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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// 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 -} - -// GetPublicAddressRangeOptions : The GetPublicAddressRange options. -type GetPublicAddressRangeOptions struct { - // The public address range identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewGetPublicAddressRangeOptions : Instantiate GetPublicAddressRangeOptions -func (*VpcV1) NewGetPublicAddressRangeOptions(id string) *GetPublicAddressRangeOptions { - return &GetPublicAddressRangeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetPublicAddressRangeOptions) SetID(id string) *GetPublicAddressRangeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetPublicAddressRangeOptions) SetHeaders(param map[string]string) *GetPublicAddressRangeOptions { - 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 -} - -// 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. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The file 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 -} - -// 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. - 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 -} - -// GetVPCRouteResponse : GetVPCRouteResponse struct -type GetVPCRouteResponse struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Action *string `json:"action" validate:"required"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin" validate:"required"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. - // - // If subnets are attached to the route's routing table, egress traffic from those - // subnets in this zone will be subject to this route. If this route's routing table - // has any of `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic - // from those ingress sources arriving in this zone will be subject to this route. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the GetVPCRouteResponse.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - GetVPCRouteResponseActionDelegateConst = "delegate" - GetVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" - GetVPCRouteResponseActionDeliverConst = "deliver" - GetVPCRouteResponseActionDropConst = "drop" -) - -// Constants associated with the GetVPCRouteResponse.LifecycleState property. -// The lifecycle state of the route. -const ( - GetVPCRouteResponseLifecycleStateDeletingConst = "deleting" - GetVPCRouteResponseLifecycleStateFailedConst = "failed" - GetVPCRouteResponseLifecycleStatePendingConst = "pending" - GetVPCRouteResponseLifecycleStateStableConst = "stable" - GetVPCRouteResponseLifecycleStateSuspendedConst = "suspended" - GetVPCRouteResponseLifecycleStateUpdatingConst = "updating" - GetVPCRouteResponseLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the GetVPCRouteResponse.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 ( - GetVPCRouteResponseOriginServiceConst = "service" - GetVPCRouteResponseOriginUserConst = "user" -) - -// UnmarshalGetVPCRouteResponse unmarshals an instance of GetVPCRouteResponse from the specified map of raw messages. -func UnmarshalGetVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GetVPCRouteResponse) - 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 -} - -// 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. - // - // 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. - 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. - // - // 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. - 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. - // - // 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. - 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. -// -// 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" - IkePolicyAuthenticationAlgorithmSha256Const = "sha256" - IkePolicyAuthenticationAlgorithmSha384Const = "sha384" - IkePolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IkePolicy.EncryptionAlgorithm property. -// 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" - IkePolicyEncryptionAlgorithmAes256Const = "aes256" - IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IkePolicy.NegotiationMode property. -// 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" -) - -// 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// IkePolicyConnectionCollection : IkePolicyConnectionCollection struct -type IkePolicyConnectionCollection struct { - // 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. - 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"` -} - -// 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, 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 *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. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(ikePolicyPatch.AuthenticationAlgorithm) { - _patch["authentication_algorithm"] = ikePolicyPatch.AuthenticationAlgorithm - } - 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 -} - -// IkePolicyReference : IkePolicyReference struct -type IkePolicyReference 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 IKE policy. - 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, 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 -} - -// 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 -} - -// 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 - // - // 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. - 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. - // - // 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 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. - 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"` - - // The Perfect Forward Secrecy group - // - // 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. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // 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"` -} - -// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. -// 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 ( - IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" - IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" - IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IPsecPolicy.EncapsulationMode property. -// 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" -) - -// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. -// 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 ( - IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" - IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IPsecPolicy.Pfs property. -// The Perfect Forward Secrecy group -// -// 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" - 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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 *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"` -} - -// 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, 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 *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 -} - -// IPsecPolicyPatch : IPsecPolicyPatch struct -type IPsecPolicyPatch struct { - // The authentication algorithm - // - // 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` - // - // The `triple_des` algorithm has been deprecated. - 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"` - - // 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` -// -// The `md5` and `sha1` algorithms have been deprecated. -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` -// -// The `triple_des` algorithm has been deprecated. -const ( - IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the IPsecPolicyPatch.Pfs property. -// The Perfect Forward Secrecy group. -// -// 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" - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(iPsecPolicyPatch.AuthenticationAlgorithm) { - _patch["authentication_algorithm"] = iPsecPolicyPatch.AuthenticationAlgorithm - } - 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 -} - -// IPsecPolicyReference : IPsecPolicyReference struct -type IPsecPolicyReference 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 IPsec policy. - 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, 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 -} - -// Image : Image struct -type Image struct { - // The usage constraints to match against the requested instance or bare metal server - // properties to determine compatibility. - AllowedUse *ImageAllowedUse `json:"allowed_use" validate:"required"` - - 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"` - - // The metadata for the imported 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" 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 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 to create resources - // - deleting: image is being deleted, and can no longer be used to create - // resources - // - deprecated: image is slated to be deleted, but can still be used to create - // resources - // - failed: image was not created successfully, and cannot be used to create - // resources - // - obsolete: image is slated to be deleted, and can no longer be used to create - // resources - // - pending: image is being imported, and cannot yet be used to create resources - // - 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"` - - // The reasons for the current status (if any). - 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. - 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 to create resources -// - deleting: image is being deleted, and can no longer be used to create -// resources -// - deprecated: image is slated to be deleted, but can still be used to create -// resources -// - failed: image was not created successfully, and cannot be used to create -// resources -// - obsolete: image is slated to be deleted, and can no longer be used to create -// resources -// - pending: image is being imported, and cannot yet be used to create resources -// - 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.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 -// - `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, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUse) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) - return - } - 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, "remote", &obj.Remote, UnmarshalImageRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-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, "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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageAllowedUse : ImageAllowedUse struct -type ImageAllowedUse struct { - // The API version with which to evaluate the expressions. - ApiVersion *string `json:"api_version" validate:"required"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `BareMetalServer` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server" validate:"required"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance" validate:"required"` -} - -// UnmarshalImageAllowedUse unmarshals an instance of ImageAllowedUse from the specified map of raw messages. -func UnmarshalImageAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageAllowedUse) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageAllowedUsePatch : ImageAllowedUsePatch struct -type ImageAllowedUsePatch struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalImageAllowedUsePatch unmarshals an instance of ImageAllowedUsePatch from the specified map of raw messages. -func UnmarshalImageAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageAllowedUsePatch) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the ImageAllowedUsePatch -func (imageAllowedUsePatch *ImageAllowedUsePatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(imageAllowedUsePatch.ApiVersion) { - _patch["api_version"] = imageAllowedUsePatch.ApiVersion - } - if !core.IsNil(imageAllowedUsePatch.BareMetalServer) { - _patch["bare_metal_server"] = imageAllowedUsePatch.BareMetalServer - } - if !core.IsNil(imageAllowedUsePatch.Instance) { - _patch["instance"] = imageAllowedUsePatch.Instance - } - - return -} - -// ImageAllowedUsePrototype : ImageAllowedUsePrototype struct -type ImageAllowedUsePrototype struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query - // parameter value will be used. - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using this image. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this image. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalImageAllowedUsePrototype unmarshals an instance of ImageAllowedUsePrototype from the specified map of raw messages. -func UnmarshalImageAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageAllowedUsePrototype) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageBareMetalServerProfileCollection : ImageBareMetalServerProfileCollection struct -type ImageBareMetalServerProfileCollection struct { - // A page of bare metal server profiles compatible with the image. - BareMetalServerProfiles []BareMetalServerProfileReference `json:"bare_metal_server_profiles" 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"` -} - -// UnmarshalImageBareMetalServerProfileCollection unmarshals an instance of ImageBareMetalServerProfileCollection from the specified map of raw messages. -func UnmarshalImageBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageBareMetalServerProfileCollection) - err = core.UnmarshalModel(m, "bare_metal_server_profiles", &obj.BareMetalServerProfiles, UnmarshalBareMetalServerProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server_profiles-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 *ImageBareMetalServerProfileCollection) 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 -} - -// 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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 resource type. - 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. - // - // 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 []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 resource type. -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. -// -// 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" - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(imageExportJobPatch.Name) { - _patch["name"] = imageExportJobPatch.Name - } - - 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"` - - // A 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 { - // The export jobs for the image. - 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 { - // The checksums for the imported 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 imported 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, in hexadecimal. - 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 -} - -// ImageInstanceProfileCollection : ImageInstanceProfileCollection struct -type ImageInstanceProfileCollection struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // A page of instance profiles compatible with the image. - InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `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"` -} - -// UnmarshalImageInstanceProfileCollection unmarshals an instance of ImageInstanceProfileCollection from the specified map of raw messages. -func UnmarshalImageInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageInstanceProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_profiles-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 *ImageInstanceProfileCollection) 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 -} - -// ImagePatch : ImagePatch struct -type ImagePatch struct { - // The usage constraints to be matched against the requested instance or bare metal server - // properties to determine compatibility. - AllowedUse *ImageAllowedUsePatch `json:"allowed_use,omitempty"` - - // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePatch) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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) { - _patch = map[string]interface{}{} - if !core.IsNil(imagePatch.AllowedUse) { - _patch["allowed_use"] = imagePatch.AllowedUse.asPatch() - } - if !core.IsNil(imagePatch.DeprecationAt) { - _patch["deprecation_at"] = imagePatch.DeprecationAt - } - if !core.IsNil(imagePatch.Name) { - _patch["name"] = imagePatch.Name - } - if !core.IsNil(imagePatch.ObsolescenceAt) { - _patch["obsolescence_at"] = imagePatch.ObsolescenceAt - } - - return -} - -// ImagePrototype : ImagePrototype struct -// Models which "extend" this model: -// - ImagePrototypeImageByFile -// - ImagePrototypeImageBySourceVolume -type ImagePrototype struct { - // The usage constraints to match against the requested instance or bare metal server - // properties to determine compatibility. - AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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 *Deleted `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 *ImageRemoteContextImageReference `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, 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, UnmarshalImageRemoteContextImageReference) - 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 -} - -// 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"` -} - -// 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageRemoteContextImageReference : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type ImageRemoteContextImageReference 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"` -} - -// UnmarshalImageRemoteContextImageReference unmarshals an instance of ImageRemoteContextImageReference from the specified map of raw messages. -func UnmarshalImageRemoteContextImageReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageRemoteContextImageReference) - 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"` - - // A 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"` - - // The boot volume attachment for this virtual server instance. - 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"` - - // 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"` - - // 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"` - - // 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"` - - // 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. - // - // 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. - 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.ConfidentialComputeMode property. -// The confidential compute mode for this virtual server instance. -const ( - InstanceConfidentialComputeModeDisabledConst = "disabled" - InstanceConfidentialComputeModeSgxConst = "sgx" - InstanceConfidentialComputeModeTdxConst = "tdx" -) - -// 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.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()) - 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.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()) - 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 : The availability policy for this virtual server instance. -type InstanceAvailabilityPolicy struct { - // The action to perform if the compute host experiences a failure: - // - `restart`: Restart the virtual server instance - // - `stop`: Leave the virtual server instance stopped - // - // See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. - // - // 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`: Restart the virtual server instance -// - `stop`: Leave the virtual server instance stopped -// -// See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. -// -// 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`: Restart the virtual server instance - // - `stop`: Leave the virtual server instance stopped. - 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`: Restart the virtual server instance -// - `stop`: Leave the virtual server instance stopped. -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 -} - -// 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 : The availability policy to use for this virtual server instance. -type InstanceAvailabilityPolicyPrototype struct { - // The action to perform if the compute host experiences a failure: - // - `restart`: Restart the virtual server instance - // - `stop`: Leave the virtual server instance stopped - // - // See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. - 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`: Restart the virtual server instance -// - `stop`: Leave the virtual server instance stopped -// -// See [handling host failures](https://cloud.ibm.com/docs/vpc?topic=vpc-host-failure-recovery-policies) for details. -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 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 - // 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, "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 -} - -// 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 { - // 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"` - - // 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, "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()) - 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 -} - -// 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"` - - // 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 *PageLink `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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, "", "cluster_network_attachments-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 *InstanceClusterNetworkAttachmentCollection) 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 -} - -// 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"` - - // A link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the InstanceClusterNetworkAttachmentLifecycleReason.Code property. -// A reason code for this lifecycle state: -// - `internal_error`: internal error (contact IBM support) -// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM -// support) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceClusterNetworkAttachmentLifecycleReasonCodeInternalErrorConst = "internal_error" - InstanceClusterNetworkAttachmentLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalInstanceClusterNetworkAttachmentLifecycleReason unmarshals an instance of InstanceClusterNetworkAttachmentLifecycleReason from the specified map of raw messages. -func UnmarshalInstanceClusterNetworkAttachmentLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceClusterNetworkAttachmentLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceClusterNetworkAttachmentPatch : InstanceClusterNetworkAttachmentPatch struct -type InstanceClusterNetworkAttachmentPatch struct { - // The name for this network attachment. The name must not be used by another network attachment for the instance. - // Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceClusterNetworkAttachmentPatch unmarshals an instance of InstanceClusterNetworkAttachmentPatch from the specified map of raw messages. -func UnmarshalInstanceClusterNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceClusterNetworkAttachmentPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the InstanceClusterNetworkAttachmentPatch -func (instanceClusterNetworkAttachmentPatch *InstanceClusterNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceClusterNetworkAttachmentPatch.Name) { - _patch["name"] = instanceClusterNetworkAttachmentPatch.Name - } - - return -} - -// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface : A cluster network interface for the instance cluster network attachment. This can be specified using an existing -// cluster network interface that does not already have a -// `target`, or a prototype object for a new cluster network interface. -// -// This instance must reside in the same VPC as the specified cluster network interface. The cluster network interface -// must reside in the same cluster network as the -// `cluster_network_interface` of any other `cluster_network_attachments` for this instance. -// Models which "extend" this model: -// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment -// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity -type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface struct { - // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this cluster network interface. The name must not be used by another interface in the cluster network. - // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the cluster network interface. May be either - // a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP - // prototype object which will be used to create a new cluster network subnet reserved IP. - // - // If a cluster network subnet reserved IP identity is provided, the specified cluster - // network subnet reserved IP must be unbound. - // - // If a cluster network subnet reserved IP prototype object with an address is provided, - // the address must be available on the cluster network interface's cluster network - // subnet. If no address is specified, an available address on the cluster network subnet - // will be automatically selected and reserved. - PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The associated cluster network subnet. Required if `primary_ip` does not specify a - // cluster network subnet reserved IP identity. - Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"` - - // The unique identifier for this cluster network interface. - ID *string `json:"id,omitempty"` - - // The URL for this cluster network interface. - Href *string `json:"href,omitempty"` -} - -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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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"` -} - -// 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. - 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 { - // The disks for the instance. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceDiskPatch.Name) { - _patch["name"] = instanceDiskPatch.Name - } - - return -} - -// InstanceDiskReference : InstanceDiskReference struct -type InstanceDiskReference 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 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, 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 -} - -// 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. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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"` -} - -// Constants associated with the InstanceGpu.Manufacturer property. -// The GPU manufacturer. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceGpuManufacturerAmdConst = "amd" - InstanceGpuManufacturerIntelConst = "intel" - InstanceGpuManufacturerNvidiaConst = "nvidia" -) - -// 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 - // - // 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. - 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 -// -// 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" - 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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"` - - // A 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. - 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. - 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 - // - // 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. - 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 -// -// 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" - 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 -} - -// 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. - 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 -} - -// 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 - // `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"` - - 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, "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()) - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceGroupManagerActionPatch.AutoDelete) { - _patch["auto_delete"] = instanceGroupManagerActionPatch.AutoDelete - } - 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 -} - -// 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 *Deleted `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, 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 -} - -// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct -type InstanceGroupManagerActionsCollection struct { - // A page of actions for the instance group manager. - Actions []InstanceGroupManagerActionIntf `json:"actions" 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"` -} - -// 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, 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 *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 -} - -// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct -type InstanceGroupManagerCollection 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 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 - // except the last page. - Next *PageLink `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, 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, "managers", &obj.Managers, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "managers-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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceGroupManagerPatch.AggregationWindow) { - _patch["aggregation_window"] = instanceGroupManagerPatch.AggregationWindow - } - 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 -} - -// 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 - // - // 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 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 enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 *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 policies for the instance group manager. - 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, 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, "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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceGroupManagerPolicyPatch.MetricType) { - _patch["metric_type"] = instanceGroupManagerPolicyPatch.MetricType - } - if !core.IsNil(instanceGroupManagerPolicyPatch.MetricValue) { - _patch["metric_value"] = instanceGroupManagerPolicyPatch.MetricValue - } - if !core.IsNil(instanceGroupManagerPolicyPatch.Name) { - _patch["name"] = instanceGroupManagerPolicyPatch.Name - } - - 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 *Deleted `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, 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 - } - 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 *Deleted `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, 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 - } - 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 *Deleted `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, 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, "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 - // - // 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. - 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 -// -// 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" - 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // 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 - // except the last page. - Next *PageLink `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, 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, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) - if err != nil { - err = core.SDKErrorf(err, "", "memberships-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 *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 -} - -// 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"` -} - -// 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()) - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete) { - _patch["delete_instance_on_membership_delete"] = instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete - } - if !core.IsNil(instanceGroupMembershipPatch.Name) { - _patch["name"] = instanceGroupMembershipPatch.Name - } - - 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"` - - // The instance template to use when creating new instances. - // - // The specified template must not have `default_trusted_profile.auto_link` set to `true`. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceGroupPatch.ApplicationPort) { - _patch["application_port"] = instanceGroupPatch.ApplicationPort - } - 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 -} - -// 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 *Deleted `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, 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 - } - 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. - // - // 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"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // A 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. -// -// 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" - 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: - // - `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. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` - - // A 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: -// - `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" -) - -// 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 -} - -// 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. - 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 { - // The network attachments for the instance. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceNetworkAttachmentPatch.Name) { - _patch["name"] = instanceNetworkAttachmentPatch.Name - } - - 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"` - - // The 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 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"` - - // 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"` -} - -// 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 -} - -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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - 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 *Deleted `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"` - - // The virtual network interface for this instance network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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, 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, "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.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 -} - -// InstancePatch : InstancePatch struct -type InstancePatch struct { - 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"` - - // 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. 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`. - // - 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"` -} - -// 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" - InstancePatchConfidentialComputeModeTdxConst = "tdx" -) - -// 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.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()) - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instancePatch.AvailabilityPolicy) { - _patch["availability_policy"] = instancePatch.AvailabilityPolicy.asPatch() - } - 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. 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`. -// - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 : The placement restrictions for the virtual server instance. -// 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 *Deleted `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, 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 -} - -// InstancePlacementTargetPatch : 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`. -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 : The placement restrictions to use for the virtual server instance. -// -// If specified, `reservation_affinity.policy` must be `disabled`. -// 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"` - - 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. - 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"` - - 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. - // - `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"` - - // 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"` - - VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` - - VcpuManufacturer InstanceProfileVcpuManufacturerIntf `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, "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()) - 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.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()) - 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()) - 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 -} - -// 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. - 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" -) - -// Constants associated with the InstanceProfileGpuManufacturer.Values property. -// The GPU manufacturer. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceProfileGpuManufacturerValuesAmdConst = "amd" - InstanceProfileGpuManufacturerValuesIntelConst = "intel" - InstanceProfileGpuManufacturerValuesNvidiaConst = "nvidia" -) - -// 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 -} - -// 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" - InstanceProfileSupportedConfidentialComputeModesDefaultTdxConst = "tdx" -) - -// 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: -// - `disabled`: No confidential compute functionality -// - `sgx`: Intel Software Guard Extensions -// - `tdx`: Intel Trust Domain Extensions -// -// 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" - InstanceProfileSupportedConfidentialComputeModesValuesTdxConst = "tdx" -) - -// 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 -// - 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 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" -) - -// Constants associated with the InstanceProfileVcpuArchitecture.Value property. -// The VCPU architecture for an instance with this profile. -const ( - InstanceProfileVcpuArchitectureValueAmd64Const = "amd64" - InstanceProfileVcpuArchitectureValueS390xConst = "s390x" -) - -// 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, "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 -// Models which "extend" this model: -// - InstanceProfileVcpuManufacturerFixed -// - InstanceProfileVcpuManufacturerDependent -type InstanceProfileVcpuManufacturer struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The VCPU manufacturer for an instance with this profile. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the InstanceProfileVcpuManufacturer.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" -) - -// Constants associated with the InstanceProfileVcpuManufacturer.Value property. -// The VCPU manufacturer for an instance with this profile. -const ( - InstanceProfileVcpuManufacturerValueAmdConst = "amd" - InstanceProfileVcpuManufacturerValueIBMConst = "ibm" - InstanceProfileVcpuManufacturerValueIntelConst = "intel" -) - -func (*InstanceProfileVcpuManufacturer) isaInstanceProfileVcpuManufacturer() bool { - return true -} - -type InstanceProfileVcpuManufacturerIntf interface { - isaInstanceProfileVcpuManufacturer() bool -} - -// 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, "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 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. - 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. 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - // The reservation affinity settings for this virtual server instance. - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 *Deleted `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, 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 - } - 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: - // - `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 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: -// - `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 ( - InstanceReservationAffinityPolicyAutomaticConst = "automatic" - 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: - // - `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. - 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`, `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: -// - `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 ( - InstanceReservationAffinityPatchPolicyAutomaticConst = "automatic" - 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 -} - -// 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 : The reservation affinity settings for this virtual server instance. -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 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. - // - // 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 -// - `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 must be `disabled` if `placement_target` is specified. -const ( - InstanceReservationAffinityPrototypePolicyAutomaticConst = "automatic" - 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"` - - // A 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 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - // The reservation affinity settings for this virtual server instance. - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 *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 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, 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, "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 -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(instanceTemplatePatch.Name) { - _patch["name"] = instanceTemplatePatch.Name - } - - 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 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. - 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. 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - // The reservation affinity settings for this virtual server instance. - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 *Deleted `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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceVcpu : The virtual server instance VCPU configuration. -type InstanceVcpu struct { - // The VCPU architecture. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer for this instance. It may be `unassigned` when instance `status` is `failed`, `pending`, or - // `stopped`. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// Constants associated with the InstanceVcpu.Architecture property. -// The VCPU architecture. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceVcpuArchitectureAmd64Const = "amd64" - InstanceVcpuArchitectureS390xConst = "s390x" -) - -// Constants associated with the InstanceVcpu.Manufacturer property. -// The VCPU manufacturer for this instance. It may be `unassigned` when instance `status` is `failed`, `pending`, or -// `stopped`. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceVcpuManufacturerAmdConst = "amd" - InstanceVcpuManufacturerIBMConst = "ibm" - InstanceVcpuManufacturerIntelConst = "intel" - InstanceVcpuManufacturerUnassignedConst = "unassigned" -) - -// 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 (such as - // `SHA256`). - // - // The length of this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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 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 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" -) - -// 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 *PageLink `json:"first" validate:"required"` - - // A page 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 *PageLink `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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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 (such as - // `SHA256`). - // - // The length of this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(keyPatch.Name) { - _patch["name"] = keyPatch.Name - } - - 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 *Deleted `json:"deleted,omitempty"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as - // `SHA256`). - // - // The length of this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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, UnmarshalDeleted) - 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 -} - -// 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 `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"` - - // 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 -} - -// 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) - 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 -} - -// 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. - 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 `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"` - - // 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 -} - -// 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{} -} - -// 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 -} - -// 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) - 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="` - - // 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 -} - -// 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 -} - -// 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 - return options -} - -// ListImageBareMetalServerProfilesOptions : The ListImageBareMetalServerProfiles options. -type ListImageBareMetalServerProfilesOptions struct { - // The image 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 -} - -// NewListImageBareMetalServerProfilesOptions : Instantiate ListImageBareMetalServerProfilesOptions -func (*VpcV1) NewListImageBareMetalServerProfilesOptions(id string) *ListImageBareMetalServerProfilesOptions { - return &ListImageBareMetalServerProfilesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListImageBareMetalServerProfilesOptions) SetID(id string) *ListImageBareMetalServerProfilesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListImageBareMetalServerProfilesOptions) SetStart(start string) *ListImageBareMetalServerProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListImageBareMetalServerProfilesOptions) SetLimit(limit int64) *ListImageBareMetalServerProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImageBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListImageBareMetalServerProfilesOptions { - 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 -} - -// ListImageInstanceProfilesOptions : The ListImageInstanceProfiles options. -type ListImageInstanceProfilesOptions struct { - // The image 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 -} - -// NewListImageInstanceProfilesOptions : Instantiate ListImageInstanceProfilesOptions -func (*VpcV1) NewListImageInstanceProfilesOptions(id string) *ListImageInstanceProfilesOptions { - return &ListImageInstanceProfilesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListImageInstanceProfilesOptions) SetID(id string) *ListImageInstanceProfilesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListImageInstanceProfilesOptions) SetStart(start string) *ListImageInstanceProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListImageInstanceProfilesOptions) SetLimit(limit int64) *ListImageInstanceProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImageInstanceProfilesOptions) SetHeaders(param map[string]string) *ListImageInstanceProfilesOptions { - 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"` - - // 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"` - - // Filters the collection to images with a `remote.account.id` property matching the specified account identifier. - // - // This parameter also supports the values null and not:null which filter the collection to resources which have no - // remote account identifier or any remote account identifier, respectively. - RemoteAccountID *string `json:"remote.account.id,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" -) - -// 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{} -} - -// 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 -} - -// SetUserDataFormat : Allow user to set UserDataFormat -func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *ListImagesOptions { - _options.UserDataFormat = userDataFormat - return _options -} - -// SetRemoteAccountID : Allow user to set RemoteAccountID -func (_options *ListImagesOptions) SetRemoteAccountID(remoteAccountID string) *ListImagesOptions { - _options.RemoteAccountID = core.StringPtr(remoteAccountID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { - options.Headers = param - 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. - 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 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"` - - // 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 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"` - - // 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"` - - // 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 -} - -// 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{} -} - -// 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 -} - -// 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) - 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 -} - -// 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) - 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="` - - // 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 -} - -// 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 -} - -// 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 - 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"` - - // 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 -} - -// 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 -} - -// 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 - 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="` - - // 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 -} - -// 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 -} - -// SetStart : Allow user to set Start -func (_options *ListLoadBalancerPoolMembersOptions) SetStart(start string) *ListLoadBalancerPoolMembersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListLoadBalancerPoolMembersOptions) SetLimit(limit int64) *ListLoadBalancerPoolMembersOptions { - _options.Limit = core.Int64Ptr(limit) - 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 -} - -// 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 -} - -// ListPublicAddressRangesOptions : The ListPublicAddressRanges options. -type ListPublicAddressRangesOptions 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 -} - -// NewListPublicAddressRangesOptions : Instantiate ListPublicAddressRangesOptions -func (*VpcV1) NewListPublicAddressRangesOptions() *ListPublicAddressRangesOptions { - return &ListPublicAddressRangesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListPublicAddressRangesOptions) SetStart(start string) *ListPublicAddressRangesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListPublicAddressRangesOptions) SetLimit(limit int64) *ListPublicAddressRangesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListPublicAddressRangesOptions) SetResourceGroupID(resourceGroupID string) *ListPublicAddressRangesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListPublicAddressRangesOptions) SetHeaders(param map[string]string) *ListPublicAddressRangesOptions { - 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 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"` - - // 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 -} - -// 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{} -} - -// 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 -} - -// 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) - 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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// ListSnapshotInstanceProfilesOptions : The ListSnapshotInstanceProfiles options. -type ListSnapshotInstanceProfilesOptions struct { - // The snapshot 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 -} - -// NewListSnapshotInstanceProfilesOptions : Instantiate ListSnapshotInstanceProfilesOptions -func (*VpcV1) NewListSnapshotInstanceProfilesOptions(id string) *ListSnapshotInstanceProfilesOptions { - return &ListSnapshotInstanceProfilesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListSnapshotInstanceProfilesOptions) SetID(id string) *ListSnapshotInstanceProfilesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListSnapshotInstanceProfilesOptions) SetStart(start string) *ListSnapshotInstanceProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSnapshotInstanceProfilesOptions) SetLimit(limit int64) *ListSnapshotInstanceProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotInstanceProfilesOptions) SetHeaders(param map[string]string) *ListSnapshotInstanceProfilesOptions { - 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 a `crn` 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 -} - -// ListVolumeInstanceProfilesOptions : The ListVolumeInstanceProfiles options. -type ListVolumeInstanceProfilesOptions struct { - // The volume 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 -} - -// NewListVolumeInstanceProfilesOptions : Instantiate ListVolumeInstanceProfilesOptions -func (*VpcV1) NewListVolumeInstanceProfilesOptions(id string) *ListVolumeInstanceProfilesOptions { - return &ListVolumeInstanceProfilesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListVolumeInstanceProfilesOptions) SetID(id string) *ListVolumeInstanceProfilesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVolumeInstanceProfilesOptions) SetStart(start string) *ListVolumeInstanceProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVolumeInstanceProfilesOptions) SetLimit(limit int64) *ListVolumeInstanceProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVolumeInstanceProfilesOptions) SetHeaders(param map[string]string) *ListVolumeInstanceProfilesOptions { - 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 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 a `name` property matching the exact specified name. - Name *string `json:"name,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 an item in the `tags` property matching the exact specified tag. - Tag *string `json:"tag,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 -} - -// 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 -} - -// 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 -} - -// SetName : Allow user to set Name -func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { - _options.Name = core.StringPtr(name) - 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 -} - -// SetTag : Allow user to set Tag -func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions { - _options.Tag = core.StringPtr(tag) - 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 -} - -// 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="` - - // 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 -} - -// 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 -} - -// 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 *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 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 load balancer pool members attached to this load balancer. - AttachedLoadBalancerPoolMembers []LoadBalancerPoolMemberReference `json:"attached_load_balancer_pool_members" 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"` - - // The CRN for this load balancer. - 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`. - // - // Not supported by private path load balancers. - Dns *LoadBalancerDns `json:"dns,omitempty"` - - // The supported `failsafe_policy.action` values for this load balancer's pools. - FailsafePolicyActions []string `json:"failsafe_policy_actions" validate:"required"` - - // The fully qualified domain name assigned to this load balancer. - Hostname *string `json:"hostname" validate:"required"` - - // 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"` - - // 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"` - - // 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. - // - // 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. - 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. - 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. - // - // Will be empty if `is_public` is `false`. - 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // Indicates whether this load balancer supports security groups. - SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` - - // 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"` - - // Indicates whether this load balancer supports UDP. - 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.FailsafePolicyActions property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. -// - `drop`: Drops requests. -// - `fail`: Fails requests with an HTTP `503` status code. -// - `forward`: Forwards requests to the `target` pool. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerFailsafePolicyActionsBypassConst = "bypass" - LoadBalancerFailsafePolicyActionsDropConst = "drop" - LoadBalancerFailsafePolicyActionsFailConst = "fail" - LoadBalancerFailsafePolicyActionsForwardConst = "forward" -) - -// 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" -) - -// 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, "access_mode", &obj.AccessMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "attached_load_balancer_pool_members", &obj.AttachedLoadBalancerPoolMembers, UnmarshalLoadBalancerPoolMemberReference) - if err != nil { - err = core.SDKErrorf(err, "", "attached_load_balancer_pool_members-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()) - 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, "failsafe_policy_actions", &obj.FailsafePolicyActions) - if err != nil { - err = core.SDKErrorf(err, "", "failsafe_policy_actions-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_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()) - 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, UnmarshalReservedIPReference) - 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.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()) - 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // 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 - // except the last page. - Next *PageLink `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, 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, "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, 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 *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 -} - -// 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`. -// -// Not supported by private path load balancers. -type LoadBalancerDns struct { - // The DNS instance associated with this load balancer. - Instance *DnsInstanceReferenceLoadBalancerDnsContext `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, UnmarshalDnsInstanceReferenceLoadBalancerDnsContext) - 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`. -// -// Not supported by private path load balancers. -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 -} - -// 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 -// `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. - // - // 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 CRN for this load balancer. - CRN *string `json:"crn,omitempty"` - - // The URL for this load balancer. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { - return true -} - -type LoadBalancerIdentityIntf interface { - isaLoadBalancerIdentity() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 - // 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 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"` - - // 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 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 - // 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. - PortMax *int64 `json:"port_max" validate:"required"` - - // The inclusive lower bound of the range of ports used by this 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 { - // The listeners for the load balancer. - 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 URL for this load balancer pool. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool { - return true -} - -type LoadBalancerListenerDefaultPoolPatchIntf interface { - isaLoadBalancerListenerDefaultPoolPatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - 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 -} - -// 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. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - 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 URL for this load balancer listener. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { - return true -} - -type LoadBalancerListenerIdentityIntf interface { - isaLoadBalancerListenerIdentity() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 - // 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 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 - // 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 inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. Updating - // `port` updates `port_min` to the same value. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `1`. - // - // Each listener in the load balancer must have a non-overlapping port range and - // `protocol` combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. - 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`. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `65535`. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. Protocol values of `tcp`, `http` and - // `https` share the TCP port space. - 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`. Updating - // `port_min` updates `port` to the same value. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `1`. - // - // Each listener in the load balancer must have a non-overlapping port range and - // `protocol` combination. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a non-overlapping port range 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 non-overlapping port range 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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPatch.AcceptProxyProtocol) { - _patch["accept_proxy_protocol"] = loadBalancerListenerPatch.AcceptProxyProtocol - } - 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: - // - `forward_to_listener`: Requests will be forwarded to the specified `target` - // listener - // - `forward_to_pool`: 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 URL for this load balancer policy. - Href *string `json:"href" validate:"required"` - - // 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 - // listener. - Name *string `json:"name" validate:"required"` - - // The 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_to_listener`, specify a `LoadBalancerListenerIdentity` - // - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` - // - 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_to_listener`: Requests will be forwarded to the specified `target` -// listener -// - `forward_to_pool`: 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 ( - LoadBalancerListenerPolicyActionForwardToListenerConst = "forward_to_listener" - LoadBalancerListenerPolicyActionForwardToPoolConst = "forward_to_pool" - 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 { - // The policies for the load balancer listener. - 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"` - - // The 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_to_listener`, specify a `LoadBalancerListenerIdentity` for a - // listener in this load balancer. - // - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in - // this load balancer. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer - // with a `protocol` of `https`. - // - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPolicyPatch.Name) { - _patch["name"] = loadBalancerListenerPolicyPatch.Name - } - 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: - // - `forward_to_listener`: Requests will be forwarded to the specified - // `target` listener. - // - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. - // - `https_redirect`: Requests will be redirected to the specified `target.listener`. - // This listener must have a `protocol` of `http`, and the target listener must - // have a `protocol` of `https`. - // - `redirect`: Requests will be redirected to the specified `target.url` - // - `reject`: Requests will be rejected with a `403` status code. - Action *string `json:"action" validate:"required"` - - // 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 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this - // load balancer to forward to. - // - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to specify a pool in - // this load balancer to forward to. - // - If `action` is `https_redirect`, use - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this - // load balancer to redirect to. - // - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to - // specify a URL to redirect to. - Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. -// The policy action: -// - `forward_to_listener`: Requests will be forwarded to the specified -// `target` listener. -// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool. -// - `https_redirect`: Requests will be redirected to the specified `target.listener`. -// This listener must have a `protocol` of `http`, and the target listener must -// have a `protocol` of `https`. -// - `redirect`: Requests will be redirected to the specified `target.url` -// - `reject`: Requests will be rejected with a `403` status code. -const ( - LoadBalancerListenerPolicyPrototypeActionForwardToListenerConst = "forward_to_listener" - LoadBalancerListenerPolicyPrototypeActionForwardToPoolConst = "forward_to_pool" - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer policy. - Href *string `json:"href" validate:"required"` - - // 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 - // 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct -type LoadBalancerListenerPolicyRule struct { - // 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. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // 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. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer listener policy rule. - 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. - // - // 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. - // - // 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 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" - 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. -// -// 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" - LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRuleTypePathConst = "path" - LoadBalancerListenerPolicyRuleTypeQueryConst = "query" - LoadBalancerListenerPolicyRuleTypeSniHostnameConst = "sni_hostname" -) - -// 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 { - // The rules for the load balancer listener policy. - 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 for the rule. - Condition *string `json:"condition,omitempty"` - - // The field to match for this rule. - // - If the `type` is `header`, this property must be specified. - // - If the `type` is `body` or `query`, this property may be specified. - // - For all other types, this property must not be specified. - Field *string `json:"field,omitempty"` - - // The content the rule applies to: - // - `body`: The UTF-8 form-encoded HTTP request body - // - `header`: The HTTP header - // - `hostname`: The fully-qualified domain name of the server specified in the Host - // HTTP request header - // - `path`: The path of the HTTP request - // - `query`: The query of the HTTP request URL - // - `sni_hostname`: The fully-qualified domain name of the server provided in the - // "server name indicator" extension during TLS negotiation - // - // - For listeners with `protocol` `http` or `https`, any type may be specified. - // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. - Type *string `json:"type,omitempty"` - - // 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"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. -// The condition for the rule. -const ( - LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. -// The content the rule applies to: -// - `body`: The UTF-8 form-encoded HTTP request body -// - `header`: The HTTP header -// - `hostname`: The fully-qualified domain name of the server specified in the Host -// HTTP request header -// - `path`: The path of the HTTP request -// - `query`: The query of the HTTP request URL -// - `sni_hostname`: The fully-qualified domain name of the server provided in the -// "server name indicator" extension during TLS negotiation -// -// - For listeners with `protocol` `http` or `https`, any type may be specified. -// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. -const ( - LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePatchTypePathConst = "path" - LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" - LoadBalancerListenerPolicyRulePatchTypeSniHostnameConst = "sni_hostname" -) - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPolicyRulePatch.Condition) { - _patch["condition"] = loadBalancerListenerPolicyRulePatch.Condition - } - 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 for the rule. - Condition *string `json:"condition" validate:"required"` - - // The field to match for this rule. - // - If the `type` is `header`, this property must be specified. - // - If the `type` is `body` or `query`, this property may be specified. - // - For all other types, this property must not be specified. - Field *string `json:"field,omitempty"` - - // The content the rule applies to: - // - `body`: The UTF-8 form-encoded HTTP request body - // - `header`: The HTTP header - // - `hostname`: The fully-qualified domain name of the server specified in the Host - // HTTP request header - // - `path`: The path of the HTTP request - // - `query`: The query of the HTTP request URL - // - `sni_hostname`: The fully-qualified domain name of the server provided in the - // "server name indicator" extension during TLS negotiation - // - // - For listeners with `protocol` `http` or `https`, any type may be specified. - // - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. - Type *string `json:"type" validate:"required"` - - // 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"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. -// The condition for the rule. -const ( - LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. -// The content the rule applies to: -// - `body`: The UTF-8 form-encoded HTTP request body -// - `header`: The HTTP header -// - `hostname`: The fully-qualified domain name of the server specified in the Host -// HTTP request header -// - `path`: The path of the HTTP request -// - `query`: The query of the HTTP request URL -// - `sni_hostname`: The fully-qualified domain name of the server provided in the -// "server name indicator" extension during TLS negotiation -// -// - For listeners with `protocol` `http` or `https`, any type may be specified. -// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified. -const ( - LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" - LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" - LoadBalancerListenerPolicyRulePrototypeTypeSniHostnameConst = "sni_hostname" -) - -// 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer listener policy rule. - Href *string `json:"href" validate:"required"` - - // 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTarget : - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` -// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` -// - 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 -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerReference -type LoadBalancerListenerPolicyTarget 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 load balancer pool. - 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. 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"` -} - -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, 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, "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_to_listener`, specify a `LoadBalancerListenerIdentity` for a -// -// listener in this load balancer. -// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in -// this load balancer. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer -// with a `protocol` of `https`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity -type LoadBalancerListenerPolicyTargetPatch struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer pool. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` - - // 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"` -} - -func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchIntf interface { - isaLoadBalancerListenerPolicyTargetPatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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_to_listener`, specify a `LoadBalancerListenerIdentity` in this -// -// load balancer to forward to. -// - If `action` is `forward_to_pool`, 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 -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype -type LoadBalancerListenerPolicyTargetPrototype struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer pool. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` - - // 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"` -} - -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 concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. - // - // Supported for load balancers in the `application` family. - // - // If unspecified, the limit will be `15000` 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 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. - // - // If unspecified, the timeout will be `50` for load balancers in the `application` family. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The listener port number. Each listener in the load balancer must have a non-overlapping port range and `protocol` - // combination. Protocol values of `tcp`, `http` and `https` share the TCP port space. - // - // If `port_min` is also specified, `port` must have the same value as `port_min`. - 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`. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `65535`. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. Protocol values of `tcp`, `http` and - // `https` share the TCP port space. - 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`. - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified. - // - // If `port` is also specified, `port_min` must have the same value as `port`. - // - // Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to - // `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be - // `1`. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. Protocol values of `tcp`, `http` and - // `https` share the TCP port space. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a non-overlapping port range 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 non-overlapping port range 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer listener. - 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, 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 - } - 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 -} - -// 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. - 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 -} - -// 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. - 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`. - // - // Not supported by private path load balancers. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPatch.Dns) { - _patch["dns"] = loadBalancerPatch.Dns.asPatch() - } - 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. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - FailsafePolicy *LoadBalancerPoolFailsafePolicy `json:"failsafe_policy" validate:"required"` - - // The health monitor of this pool. - // - // If this pool has a member targeting a load balancer then: - // - // - If the targeted load balancer has multiple subnets, this health monitor is used to - // direct traffic to the available subnets. - // - The health checks spawned by this health monitor is handled as any other traffic - // (that is, subject to the configuration of listeners and pools on the target load - // balancer). - // - This health monitor does not affect how pool member health is determined within the - // target load balancer. - // - // For more information, see [Private Path network load balancer frequently asked - // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). - HealthMonitor LoadBalancerPoolHealthMonitorIntf `json:"health_monitor" validate:"required"` - - // The URL for this load balancer pool. - 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 - // - // 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. - // - // 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"` -} - -// 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" - 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 -// -// 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" - 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, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "failsafe_policy-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 { - // The pools for the load balancer. - 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 -} - -// LoadBalancerPoolFailsafePolicy : LoadBalancerPoolFailsafePolicy struct -type LoadBalancerPoolFailsafePolicy struct { - // A load balancer failsafe policy action: - // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. - // - `drop`: Drops requests. - // - `fail`: Fails requests with an HTTP `503` status code. - // - `forward`: Forwards requests to the `target` pool. - // - // 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 healthy member count at which the failsafe policy action will be triggered. At present, this is always `0`, but - // may be modifiable in the future. - HealthyMemberThresholdCount *int64 `json:"healthy_member_threshold_count" validate:"required"` - - // If `action` is `forward`, the target pool to forward to. - // - // If `action` is not `forward`, this property will be absent. - // - // The targets supported by this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Target *LoadBalancerPoolReference `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerPoolFailsafePolicy.Action property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. -// - `drop`: Drops requests. -// - `fail`: Fails requests with an HTTP `503` status code. -// - `forward`: Forwards requests to the `target` pool. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolFailsafePolicyActionBypassConst = "bypass" - LoadBalancerPoolFailsafePolicyActionDropConst = "drop" - LoadBalancerPoolFailsafePolicyActionFailConst = "fail" - LoadBalancerPoolFailsafePolicyActionForwardConst = "forward" -) - -// UnmarshalLoadBalancerPoolFailsafePolicy unmarshals an instance of LoadBalancerPoolFailsafePolicy from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicy) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "healthy_member_threshold_count", &obj.HealthyMemberThresholdCount) - if err != nil { - err = core.SDKErrorf(err, "", "healthy_member_threshold_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolReference) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolFailsafePolicyPatch : The failsafe policy for this load balancer pool. -type LoadBalancerPoolFailsafePolicyPatch struct { - // A load balancer failsafe policy action: - // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load - // balancer must have `route_mode` enabled. - // - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. - // - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. - // - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. - // - // The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. - Action *string `json:"action,omitempty"` - - // The failsafe target pool to forward to. - // - // The specified pool must: - // - Belong to this load balancer - // - Have the same `protocol` as this pool, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not have a `failsafe_policy.action` of `forward` or `bypass`. - // - // If specified, `action` must be `forward`. - // - // Specify `null` to remove an existing failsafe target pool. - Target LoadBalancerPoolFailsafePolicyTargetPatchIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerPoolFailsafePolicyPatch.Action property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load -// balancer must have `route_mode` enabled. -// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. -// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. -// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. -// -// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. -const ( - LoadBalancerPoolFailsafePolicyPatchActionBypassConst = "bypass" - LoadBalancerPoolFailsafePolicyPatchActionDropConst = "drop" - LoadBalancerPoolFailsafePolicyPatchActionFailConst = "fail" - LoadBalancerPoolFailsafePolicyPatchActionForwardConst = "forward" -) - -// UnmarshalLoadBalancerPoolFailsafePolicyPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicyPatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch) - 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 LoadBalancerPoolFailsafePolicyPatch -func (loadBalancerPoolFailsafePolicyPatch *LoadBalancerPoolFailsafePolicyPatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Action) { - _patch["action"] = loadBalancerPoolFailsafePolicyPatch.Action - } - if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Target) { - _patch["target"] = loadBalancerPoolFailsafePolicyPatch.Target.asPatch() - } - - return -} - -// LoadBalancerPoolFailsafePolicyPrototype : LoadBalancerPoolFailsafePolicyPrototype struct -type LoadBalancerPoolFailsafePolicyPrototype struct { - // A load balancer failsafe policy action: - // - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load - // balancer must have `route_mode` enabled. - // - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. - // - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. - // - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. - // - // The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. - Action *string `json:"action,omitempty"` - - // The failsafe target pool to forward to. - // - // The specified pool must: - // - Belong to this load balancer - // - Have the same `protocol` as this pool, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Have a `failsafe_policy.action` of `fail` or `drop` - // - // If specified, `action` must be `forward`. - Target LoadBalancerPoolIdentityIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerPoolFailsafePolicyPrototype.Action property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load -// balancer must have `route_mode` enabled. -// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`. -// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`. -// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`. -// -// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer. -const ( - LoadBalancerPoolFailsafePolicyPrototypeActionBypassConst = "bypass" - LoadBalancerPoolFailsafePolicyPrototypeActionDropConst = "drop" - LoadBalancerPoolFailsafePolicyPrototypeActionFailConst = "fail" - LoadBalancerPoolFailsafePolicyPrototypeActionForwardConst = "forward" -) - -// UnmarshalLoadBalancerPoolFailsafePolicyPrototype unmarshals an instance of LoadBalancerPoolFailsafePolicyPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicyPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolFailsafePolicyTargetPatch : The failsafe target pool to forward to. -// -// The specified pool must: -// - Belong to this load balancer -// - Have the same `protocol` as this pool, or have a compatible protocol. -// At present, the compatible protocols are `http` and `https`. -// - Not have a `failsafe_policy.action` of `forward` or `bypass`. -// -// If specified, `action` must be `forward`. -// -// Specify `null` to remove an existing failsafe target pool. -// Models which "extend" this model: -// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID -// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref -type LoadBalancerPoolFailsafePolicyTargetPatch struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer pool. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolFailsafePolicyTargetPatch) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { - return true -} - -type LoadBalancerPoolFailsafePolicyTargetPatchIntf interface { - isaLoadBalancerPoolFailsafePolicyTargetPatch() bool - asPatch() map[string]interface{} -} - -// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicyTargetPatch) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatch -func (loadBalancerPoolFailsafePolicyTargetPatch *LoadBalancerPoolFailsafePolicyTargetPatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.ID) { - _patch["id"] = loadBalancerPoolFailsafePolicyTargetPatch.ID - } - if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.Href) { - _patch["href"] = loadBalancerPoolFailsafePolicyTargetPatch.Href - } - - return -} - -// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct -// Models which "extend" this model: -// - LoadBalancerPoolHealthMonitorTypeTCP -// - LoadBalancerPoolHealthMonitorTypeHttphttps -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 used 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, 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 used 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" -) - -func (*LoadBalancerPoolHealthMonitor) isaLoadBalancerPoolHealthMonitor() bool { - return true -} - -type LoadBalancerPoolHealthMonitorIntf interface { - isaLoadBalancerPoolHealthMonitor() bool -} - -// 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. 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). - // - // Specify `null` to remove a url_path. - 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 -} - -// 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 -// Models which "extend" this model: -// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype -// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype -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 to use. - // - // 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" -) - -func (*LoadBalancerPoolHealthMonitorPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { - return true -} - -type LoadBalancerPoolHealthMonitorPrototypeIntf interface { - isaLoadBalancerPoolHealthMonitorPrototype() bool -} - -// 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 URL for this load balancer pool. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerPoolIdentityIntf interface { - isaLoadBalancerPoolIdentity() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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"` - - // The health of the member. - // - // 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. - 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. - Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` - - // The weight of the member. - // - // This property will be present if the pool algorithm is `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// Constants associated with the LoadBalancerPoolMember.Health property. -// The health of the member. -// -// 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" - 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 { - // 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 page of members for the load balancer pool. - Members []LoadBalancerPoolMember `json:"members" 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"` -} - -// 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, "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, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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 *LoadBalancerPoolMemberCollection) 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 -} - -// 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. - // - // 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. - Port *int64 `json:"port,omitempty"` - - // The pool member target. - // - // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load - // balancer has a subnet in. - // - // 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. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` - - // The weight of the member. - // - // If specified, the pool algorithm must be `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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolMemberPatch.Port) { - _patch["port"] = loadBalancerPoolMemberPatch.Port - } - if !core.IsNil(loadBalancerPoolMemberPatch.Target) { - _patch["target"] = loadBalancerPoolMemberPatch.Target.asPatch() - } - if !core.IsNil(loadBalancerPoolMemberPatch.Weight) { - _patch["weight"] = loadBalancerPoolMemberPatch.Weight - } - - 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. - // - // 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. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. - // - // If the load balancer has `route_mode` set to `true`, the member must be in a zone the load - // balancer has a subnet in. - // - // 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. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // The weight of the member. - // - // If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application` - // family. - // - // If unspecified, the weight will be `50` for load balancers in the `application` family. - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer pool member. - 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTarget : The pool member target. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetInstanceReference -// - LoadBalancerPoolMemberTargetIP -// - LoadBalancerPoolMemberTargetLoadBalancerReference -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 *Deleted `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"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the LoadBalancerPoolMemberTarget.ResourceType property. -// The resource type. -const ( - LoadBalancerPoolMemberTargetResourceTypeLoadBalancerConst = "load_balancer" -) - -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, 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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_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 -} - -// LoadBalancerPoolMemberTargetPrototype : The pool member target. -// -// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load balancer has a subnet in. -// -// 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. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -// - LoadBalancerPoolMemberTargetPrototypeIP -// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity -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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 `least_connections` algorithm is only supported for load balancers that have - // `availability` with value `subnet` in the profile. - Algorithm *string `json:"algorithm,omitempty"` - - // The failsafe policy for this load balancer pool. - FailsafePolicy *LoadBalancerPoolFailsafePolicyPatch `json:"failsafe_policy,omitempty"` - - // The health monitor of this pool. - // - // If this pool has a member targeting a load balancer then: - // - // - If the targeted load balancer has multiple subnets, this health monitor will be - // used to direct traffic to the available subnets. - // - The health checks spawned by this health monitor will be handled as any other - // traffic (that is, subject to the configuration of listeners and pools on the - // target load balancer). - // - This health monitor does not affect how pool member health is determined within - // the target load balancer. - // - // For more information, see [Private Path network load balancer frequently asked - // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). - 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 or a load balancer failsafe target pool, the specified - // protocol must match or be compatible with each other'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 - // - // For load balancers in the `network` family, this property must be `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. 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" - 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 or a load balancer failsafe target pool, the specified -// protocol must match or be compatible with each other'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 -// -// For load balancers in the `network` family, this property must be `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, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "failsafe_policy-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) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolPatch.Algorithm) { - _patch["algorithm"] = loadBalancerPoolPatch.Algorithm - } - if !core.IsNil(loadBalancerPoolPatch.FailsafePolicy) { - _patch["failsafe_policy"] = loadBalancerPoolPatch.FailsafePolicy.asPatch() - } - 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 -} - -// LoadBalancerPoolPrototypeLoadBalancerContext : LoadBalancerPoolPrototypeLoadBalancerContext struct -type LoadBalancerPoolPrototypeLoadBalancerContext struct { - // 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. - // - // If this pool has a member targeting a load balancer then: - // - // - If the targeted load balancer has multiple subnets, this health monitor will be - // used to direct traffic to the available subnets. - // - The health checks spawned by this health monitor will be handled as any other - // traffic (that is, subject to the configuration of listeners and pools on the target - // load balancer). - // - This health monitor does not affect how pool member health is determined within the - // target load balancer. - // - // For more information, see [Private Path network load balancer frequently asked - // questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs). - HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `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 - // - // 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 - // `source_ip_session_persistence_supported` set to `true` in its profile. - // - // If unspecified, session persistence will be disabled, and traffic will be distributed - // across members of the pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.Algorithm property. -// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have -// `availability` with value `subnet` in the profile. -const ( - LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.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 ( - LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPConst = "http" - LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPSConst = "https" - LoadBalancerPoolPrototypeLoadBalancerContextProtocolTCPConst = "tcp" - LoadBalancerPoolPrototypeLoadBalancerContextProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.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 -// -// For load balancers in the `network` family, this property must be `disabled`. -const ( - LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV1Const = "v1" - LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV2Const = "v2" -) - -// NewLoadBalancerPoolPrototypeLoadBalancerContext : Instantiate LoadBalancerPoolPrototypeLoadBalancerContext (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolPrototypeLoadBalancerContext(algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, protocol string) (_model *LoadBalancerPoolPrototypeLoadBalancerContext, err error) { - _model = &LoadBalancerPoolPrototypeLoadBalancerContext{ - 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 -} - -// UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerPoolPrototypeLoadBalancerContext from the specified map of raw messages. -func UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolPrototypeLoadBalancerContext) - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer pool. - 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct -type LoadBalancerPoolSessionPersistence struct { - // The session persistence cookie name. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence 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"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. -// The session persistence type. -// -// 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. 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. - // - // 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. -// -// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or -// `https`. -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 -} - -// 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. - // - // If specified, the session persistence type must be `app_cookie`. - CookieName *string `json:"cookie_name,omitempty"` - - // 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. -// -// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or -// `https`. -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 -} - -// LoadBalancerProfile : LoadBalancerProfile struct -type LoadBalancerProfile struct { - AccessModes *LoadBalancerProfileAccessModes `json:"access_modes" validate:"required"` - - Availability LoadBalancerProfileAvailabilityIntf `json:"availability" validate:"required"` - - FailsafePolicyActions LoadBalancerProfileFailsafePolicyActionsIntf `json:"failsafe_policy_actions" validate:"required"` - - // 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"` - - SourceIPSessionPersistenceSupported LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf `json:"source_ip_session_persistence_supported" validate:"required"` - - // The load balancer profiles that load balancers with this profile can target. - TargetableLoadBalancerProfiles []LoadBalancerProfileReference `json:"targetable_load_balancer_profiles" 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.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.UnmarshalModel(m, "failsafe_policy_actions", &obj.FailsafePolicyActions, UnmarshalLoadBalancerProfileFailsafePolicyActions) - if err != nil { - err = core.SDKErrorf(err, "", "failsafe_policy_actions-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, "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, "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, "targetable_load_balancer_profiles", &obj.TargetableLoadBalancerProfiles, UnmarshalLoadBalancerProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "targetable_load_balancer_profiles-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 -} - -// 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. - 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 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, 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, 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 -} - -// LoadBalancerProfileFailsafePolicyActions : LoadBalancerProfileFailsafePolicyActions struct -// Models which "extend" this model: -// - LoadBalancerProfileFailsafePolicyActionsEnum -// - LoadBalancerProfileFailsafePolicyActionsDependent -type LoadBalancerProfileFailsafePolicyActions struct { - // The default failsafe policy action for this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The supported failsafe policy actions. - Values []string `json:"values,omitempty"` -} - -// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Default property. -// The default failsafe policy action for this profile. -const ( - LoadBalancerProfileFailsafePolicyActionsDefaultBypassConst = "bypass" - LoadBalancerProfileFailsafePolicyActionsDefaultDropConst = "drop" - LoadBalancerProfileFailsafePolicyActionsDefaultFailConst = "fail" - LoadBalancerProfileFailsafePolicyActionsDefaultForwardConst = "forward" -) - -// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileFailsafePolicyActionsTypeEnumConst = "enum" -) - -// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Values property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. -// - `drop`: Drops requests. -// - `fail`: Fails requests with an HTTP `503` status code. -// - `forward`: Forwards requests to the `target` pool. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerProfileFailsafePolicyActionsValuesBypassConst = "bypass" - LoadBalancerProfileFailsafePolicyActionsValuesDropConst = "drop" - LoadBalancerProfileFailsafePolicyActionsValuesFailConst = "fail" - LoadBalancerProfileFailsafePolicyActionsValuesForwardConst = "forward" -) - -func (*LoadBalancerProfileFailsafePolicyActions) isaLoadBalancerProfileFailsafePolicyActions() bool { - return true -} - -type LoadBalancerProfileFailsafePolicyActionsIntf interface { - isaLoadBalancerProfileFailsafePolicyActions() bool -} - -// UnmarshalLoadBalancerProfileFailsafePolicyActions unmarshals an instance of LoadBalancerProfileFailsafePolicyActions from the specified map of raw messages. -func UnmarshalLoadBalancerProfileFailsafePolicyActions(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileFailsafePolicyActions) - 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 -} - -// 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 -} - -// 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 -// - 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 -} - -// 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 { - // The number of active connections for this load balancer. - ActiveConnections *int64 `json:"active_connections" validate:"required"` - - // The current connection rate (connections per second) for this load balancer. - ConnectionRate *float32 `json:"connection_rate" validate:"required"` - - // The total number of bytes processed for this load balancer for the current calendar month. - DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` - - // The current throughput (in Mbps) for 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, no traffic will be allowed. - 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // 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 - // except the last page. - Next *PageLink `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, 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, "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, 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 *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 -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(networkACLPatch.Name) { - _patch["name"] = networkACLPatch.Name - } - - 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 no traffic being allowed. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` - - // The 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 *Deleted `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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRule : NetworkACLRule struct -// Models which "extend" this model: -// - NetworkACLRuleNetworkACLRuleProtocolAll -// - NetworkACLRuleNetworkACLRuleProtocolIcmp -// - NetworkACLRuleNetworkACLRuleProtocolTcpudp -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 network 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 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 ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of the TCP or UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of the TCP or UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - SourcePortMin *int64 `json:"source_port_min,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 network protocol. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. -// 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 *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 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. - 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, 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, "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 -} - -// NetworkACLRuleItem : NetworkACLRuleItem struct -// Models which "extend" this model: -// - NetworkACLRuleItemNetworkACLRuleProtocolAll -// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp -// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp -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 network 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 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 ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of the TCP or UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of the TCP or UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - SourcePortMin *int64 `json:"source_port_min,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 network protocol. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 the TCP or UDP destination port range. - // - // Must be larger than or equal to `destination_port_min`. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - // - // Must be smaller than or equal to `destination_port_max`. - 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 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 the TCP or UDP source port range. - // - // Must be larger than or equal to `source_port_min`. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - // - // Must be smaller than or equal to `source_port_max`. - 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" -) - -// 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, "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) { - _patch = map[string]interface{}{} - if !core.IsNil(networkACLRulePatch.Action) { - _patch["action"] = networkACLRulePatch.Action - } - 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.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 -} - -// NetworkACLRulePrototype : NetworkACLRulePrototype struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype -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 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. - 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 ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, - // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, - // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of the TCP or UDP source port range. - // - // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - // - // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMin *int64 `json:"source_port_min,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 network protocol. -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) { - obj := new(NetworkACLRulePrototype) - 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, "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, "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, "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, "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 -} - -// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype -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 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. - 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 ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, - // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, - // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of the TCP or UDP source port range. - // - // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - // - // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMin *int64 `json:"source_port_min,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 network protocol. -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) { - obj := new(NetworkACLRulePrototypeNetworkACLContext) - 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, "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, "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, "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, "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 -} - -// NetworkACLRuleReference : NetworkACLRuleReference struct -type NetworkACLRuleReference 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 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, 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 - } - 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"` - - // The primary IP address of this instance network interface. - 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 *Deleted `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 primary IP address of this bare metal server 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 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, 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, "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 -} - -// 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 *Deleted `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 primary IP address of this instance 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 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, 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, "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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(networkInterfacePatch.AllowIPSpoofing) { - _patch["allow_ip_spoofing"] = networkInterfacePatch.AllowIPSpoofing - } - if !core.IsNil(networkInterfacePatch.Name) { - _patch["name"] = networkInterfacePatch.Name - } - - 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 -} - -// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct -type NetworkInterfaceUnpaginatedCollection struct { - // The network interfaces for the instance. - 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 API maturity. For the API behavior documented here, specify `beta`. - Maturity *string `json:"maturity" validate:"required"` - - // 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(maturity string, id string) *ObsoleteImageOptions { - return &ObsoleteImageOptions{ - Maturity: core.StringPtr(maturity), - ID: core.StringPtr(id), - } -} - -// SetMaturity : Allow user to set Maturity -func (_options *ObsoleteImageOptions) SetMaturity(maturity string) *ObsoleteImageOptions { - _options.Maturity = core.StringPtr(maturity) - return _options -} - -// 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 { - // Indicates that 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"` - - // Indicates that images with this operating system can only be used on dedicated hosts and 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 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"` - - // The major release version of this operating system. - 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()) - 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, "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()) - 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 *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 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, 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, "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 -} - -// 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 -} - -// 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. - 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. - 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 *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 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, 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, "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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(placementGroupPatch.Name) { - _patch["name"] = placementGroupPatch.Name - } - - 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 *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"` -} - -// 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, 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 *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 -} - -// 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) { - _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 *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 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, 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, "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 -} - -// 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 *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"` -} - -// 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, 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 *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 -} - -// 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"` - - // Indicates whether this private path service gateway has zonal affinity. - // - // 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) { - _patch = map[string]interface{}{} - if !core.IsNil(privatePathServiceGatewayPatch.DefaultAccessPolicy) { - _patch["default_access_policy"] = privatePathServiceGatewayPatch.DefaultAccessPolicy - } - 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 -} - -// 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 -} - -// PublicAddressRange : PublicAddressRange struct -type PublicAddressRange struct { - // The public IPv4 range, expressed in CIDR format. - CIDR *string `json:"cidr" validate:"required"` - - // The date and time that the public address range was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this public address range. - CRN *string `json:"crn" validate:"required"` - - // The URL for this public address range. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public address range. - ID *string `json:"id" validate:"required"` - - // The number of IPv4 addresses in this public address range. - Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"` - - // The lifecycle state of the public address range. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this public address range. The name is unique across all public address ranges in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this public address range. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The target this public address range is bound to. - // - // If absent, this pubic address range is not bound to a target. - // - // The target resources supported by this property is expected to - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future - // targets may omit the `vpc` property. - Target *PublicAddressRangeTarget `json:"target,omitempty"` -} - -// Constants associated with the PublicAddressRange.LifecycleState property. -// The lifecycle state of the public address range. -const ( - PublicAddressRangeLifecycleStateDeletingConst = "deleting" - PublicAddressRangeLifecycleStateFailedConst = "failed" - PublicAddressRangeLifecycleStatePendingConst = "pending" - PublicAddressRangeLifecycleStateStableConst = "stable" - PublicAddressRangeLifecycleStateSuspendedConst = "suspended" - PublicAddressRangeLifecycleStateUpdatingConst = "updating" - PublicAddressRangeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the PublicAddressRange.ResourceType property. -// The resource type. -const ( - PublicAddressRangeResourceTypePublicAddressRangeConst = "public_address_range" -) - -// UnmarshalPublicAddressRange unmarshals an instance of PublicAddressRange from the specified map of raw messages. -func UnmarshalPublicAddressRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRange) - 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, "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, "ipv4_address_count", &obj.Ipv4AddressCount) - if err != nil { - err = core.SDKErrorf(err, "", "ipv4_address_count-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, "target", &obj.Target, UnmarshalPublicAddressRangeTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicAddressRangeCollection : PublicAddressRangeCollection struct -type PublicAddressRangeCollection 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 public address ranges. - PublicAddressRanges []PublicAddressRange `json:"public_address_ranges" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalPublicAddressRangeCollection unmarshals an instance of PublicAddressRangeCollection from the specified map of raw messages. -func UnmarshalPublicAddressRangeCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangeCollection) - 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, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRange) - if err != nil { - err = core.SDKErrorf(err, "", "public_address_ranges-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 *PublicAddressRangeCollection) 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 -} - -// PublicAddressRangePatch : PublicAddressRangePatch struct -type PublicAddressRangePatch struct { - // The name for this public address range. The name must not be used by another public address range in the region. - Name *string `json:"name,omitempty"` - - // The target to bind this public address range to. - // - // If the public address range is not currently bound to a target, both `target.vpc` and - // `target.zone` must be specified. - // - // Specify `null` to unbind the public address range from any existing target. - Target *PublicAddressRangeTargetPatch `json:"target,omitempty"` -} - -// UnmarshalPublicAddressRangePatch unmarshals an instance of PublicAddressRangePatch from the specified map of raw messages. -func UnmarshalPublicAddressRangePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangePatch) - 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, UnmarshalPublicAddressRangeTargetPatch) - 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 PublicAddressRangePatch -func (publicAddressRangePatch *PublicAddressRangePatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(publicAddressRangePatch.Name) { - _patch["name"] = publicAddressRangePatch.Name - } - if !core.IsNil(publicAddressRangePatch.Target) { - _patch["target"] = publicAddressRangePatch.Target.asPatch() - } - - return -} - -// PublicAddressRangeReference : PublicAddressRangeReference struct -type PublicAddressRangeReference struct { - // The CRN for this public address range. - 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 public address range. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public address range. - ID *string `json:"id" validate:"required"` - - // The name for this public address range. The name is unique across all public address ranges in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the PublicAddressRangeReference.ResourceType property. -// The resource type. -const ( - PublicAddressRangeReferenceResourceTypePublicAddressRangeConst = "public_address_range" -) - -// UnmarshalPublicAddressRangeReference unmarshals an instance of PublicAddressRangeReference from the specified map of raw messages. -func UnmarshalPublicAddressRangeReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangeReference) - 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 -} - -// PublicAddressRangeTarget : The target this public address range is bound to. -// -// If absent, this pubic address range is not bound to a target. -// -// The target resources supported by this property is expected to -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future targets may omit the `vpc` -// property. -type PublicAddressRangeTarget struct { - // The VPC this public address range is bound to. - VPC *VPCReference `json:"vpc,omitempty"` - - // The zone this public address range resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalPublicAddressRangeTarget unmarshals an instance of PublicAddressRangeTarget from the specified map of raw messages. -func UnmarshalPublicAddressRangeTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangeTarget) - 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 -} - -// PublicAddressRangeTargetPatch : The target to bind this public address range to. -// -// If the public address range is not currently bound to a target, both `target.vpc` and -// `target.zone` must be specified. -// -// Specify `null` to unbind the public address range from any existing target. -type PublicAddressRangeTargetPatch struct { - // The VPC to bind this public address range to, replacing any existing VPC. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The zone this public address range will reside in, replacing any existing zone. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// UnmarshalPublicAddressRangeTargetPatch unmarshals an instance of PublicAddressRangeTargetPatch from the specified map of raw messages. -func UnmarshalPublicAddressRangeTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangeTargetPatch) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the PublicAddressRangeTargetPatch -func (publicAddressRangeTargetPatch *PublicAddressRangeTargetPatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(publicAddressRangeTargetPatch.VPC) { - _patch["vpc"] = publicAddressRangeTargetPatch.VPC.asPatch() - } - if !core.IsNil(publicAddressRangeTargetPatch.Zone) { - _patch["zone"] = publicAddressRangeTargetPatch.Zone.asPatch() - } - - return -} - -// PublicAddressRangeTargetPrototype : The target to bind this public address range to. If unspecified, the public address range will not be bound to a -// target at creation. -type PublicAddressRangeTargetPrototype struct { - // The VPC to bind this public address range to. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The zone this public address range will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewPublicAddressRangeTargetPrototype : Instantiate PublicAddressRangeTargetPrototype (Generic Model Constructor) -func (*VpcV1) NewPublicAddressRangeTargetPrototype(vpc VPCIdentityIntf, zone ZoneIdentityIntf) (_model *PublicAddressRangeTargetPrototype, err error) { - _model = &PublicAddressRangeTargetPrototype{ - VPC: vpc, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalPublicAddressRangeTargetPrototype unmarshals an instance of PublicAddressRangeTargetPrototype from the specified map of raw messages. -func UnmarshalPublicAddressRangeTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicAddressRangeTargetPrototype) - 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 - } - 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 *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 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, 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, "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 -} - -// 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 *Deleted `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, 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 - } - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(publicGatewayPatch.Name) { - _patch["name"] = publicGatewayPatch.Name - } - - 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 *Deleted `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, 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 -} - -// 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. - 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. - // - // 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" -) - -// 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 { - // The regions for the account. - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 -} - -// 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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 bare metal server will be - // inaccessible unless the specified image provides another means of access. - Keys []KeyIdentityIntf `json:"keys" validate:"required"` - - // The default trusted profile to be used when initializing the bare metal server. - // - // If unspecified, no default trusted profile will be made available. - DefaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The user data to be made available when initializing the bare metal server. - 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 -} - -// SetDefaultTrustedProfile : Allow user to set DefaultTrustedProfile -func (_options *ReplaceBareMetalServerInitializationOptions) SetDefaultTrustedProfile(defaultTrustedProfile *BareMetalServerInitializationDefaultTrustedProfilePrototype) *ReplaceBareMetalServerInitializationOptions { - _options.DefaultTrustedProfile = defaultTrustedProfile - 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. - 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: - // - `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. - 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 [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"` - - // 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: -// - `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" -) - -// 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 [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 - // [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 [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 -// [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 -} - -// 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. - 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 *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 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, 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, "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 -} - -// ReservationCommittedUse : The committed use reservation configuration. -type ReservationCommittedUse struct { - // The expiration date and time for this committed use reservation. - // - // 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. - // - `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. - 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. -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 -} - -// 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. - 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. -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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 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`. - 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 [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()) - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(reservationPatch.AffinityPolicy) { - _patch["affinity_policy"] = reservationPatch.AffinityPolicy - } - if !core.IsNil(reservationPatch.Capacity) { - _patch["capacity"] = reservationPatch.Capacity.asPatch() - } - 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 -} - -// 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,omitempty"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ReservationProfile.ResourceType property. -// The resource type. -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) - 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 [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"` - - // 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 ( - ReservationProfilePatchResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" - 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 -} - -// 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 [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"` - - // 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 ( - ReservationProfilePrototypeResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" - 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 *Deleted `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, 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 -} - -// 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"` - - // A 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. - // - // 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 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"` -} - -// 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. -// -// 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" -) - -// 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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *PageLink `json:"next,omitempty"` - - // A page of reserved IPs in the 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, 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, "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 *PageLink `json:"first" validate:"required"` - - // 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. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 -} - -// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct -type ReservedIPCollectionEndpointGatewayContext struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // 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. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 *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 -} - -// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct -type ReservedIPCollectionInstanceNetworkInterfaceContext struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // 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. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 *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 -} - -// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct -type ReservedIPCollectionVirtualNetworkInterfaceContext struct { - // A link to the first page of resources. - 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"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `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"` -} - -// 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, UnmarshalPageLink) - 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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(reservedIPPatch.AutoDelete) { - _patch["auto_delete"] = reservedIPPatch.AutoDelete - } - if !core.IsNil(reservedIPPatch.Name) { - _patch["name"] = reservedIPPatch.Name - } - - 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 *Deleted `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, 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 -} - -// 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 -// - 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 *Deleted `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, 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 -} - -// 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 -} - -// 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: -// - 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 -} - -// 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: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Action *string `json:"action" validate:"required"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin" validate:"required"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. - // - // If subnets are attached to the route's routing table, egress traffic from those - // subnets in this zone will be subject to this route. If this route's routing table - // has any of `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic - // from those ingress sources arriving in this zone will be subject to this route. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the 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 -// -// 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" - 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 *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 VPC 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 VPC default 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. -// Models which "extend" this model: -// - RouteCreatorVPNGatewayReference -// - RouteCreatorVPNServerReference -type RouteCreator struct { - // 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this VPN gateway. - 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, 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 -} - -// 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this VPN gateway connection. - 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, 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 -} - -// 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. -// 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 URL for this VPN gateway connection. - Href *string `json:"href,omitempty"` -} - -func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { - return true -} - -type RouteNextHopPatchIntf interface { - isaRouteNextHopPatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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`. -// -// 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` - // 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 (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. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(routePatch.Advertise) { - _patch["advertise"] = routePatch.Advertise - } - 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 -} - -// 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 (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. - NextHop RouteNextHopPrototypeIntf `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, UnmarshalRouteNextHopPrototype) - 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 -} - -// RouteReference : RouteReference struct -type RouteReference 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 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, 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 - } - 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. - // - // 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 - // 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 CRN for this VPC routing table. - CRN *string `json:"crn" 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 group for this routing table. - ResourceGroup *ResourceGroupReference `json:"resource_group" 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, "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, "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.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_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 *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 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, 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, "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 -} - -// 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"` - - // The URL for this routing table. - Href *string `json:"href,omitempty"` -} - -func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { - return true -} - -type RoutingTableIdentityIntf interface { - isaRoutingTableIdentity() bool - asPatch() map[string]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()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the 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 - // `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) { - _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 !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 -} - -// 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"` - - // 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.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 -} - -// 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 CRN for this security group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this security group. - 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, no traffic will be allowed. - 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 *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 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, 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, "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 -} - -// 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 CRN for this security group. - CRN *string `json:"crn,omitempty"` - - // The URL for this security group. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(securityGroupPatch.Name) { - _patch["name"] = securityGroupPatch.Name - } - - return -} - -// SecurityGroupReference : SecurityGroupReference struct -type SecurityGroupReference struct { - // 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this security group. - 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, 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 - } - 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 allow. - 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 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 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 network 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 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 the TCP or UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` -} - -// Constants associated with the SecurityGroupRule.Direction property. -// The direction of traffic to allow. -const ( - SecurityGroupRuleDirectionInboundConst = "inbound" - SecurityGroupRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRule.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRule.Protocol property. -// The network protocol. -// -// 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" - 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 : SecurityGroupRuleCollection struct -type SecurityGroupRuleCollection struct { - // The rules for the security group. - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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). -// -// 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 allow. - Direction *string `json:"direction,omitempty"` - - // 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 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 allow. -const ( - SecurityGroupRulePatchDirectionInboundConst = "inbound" - SecurityGroupRulePatchDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePatch.IPVersion property. -// 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 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) { - _patch = map[string]interface{}{} - if !core.IsNil(securityGroupRulePatch.Code) { - _patch["code"] = securityGroupRulePatch.Code - } - 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 -} - -// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct -// Models which "extend" this model: -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp -type SecurityGroupRulePrototype struct { - // The direction of traffic to allow. - Direction *string `json:"direction" validate:"required"` - - // 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 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 network protocol. - 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 the TCP or 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 the TCP or 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 allow. -const ( - SecurityGroupRulePrototypeDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The network protocol. -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) { - obj := new(SecurityGroupRulePrototype) - 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, "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 -} - -// 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 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this security group. - 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, 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 - } - 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 CRN for this security group. - CRN *string `json:"crn,omitempty"` - - // The URL for this security group. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -type SecurityGroupRuleRemotePatchIntf interface { - isaSecurityGroupRuleRemotePatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. -// -// 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 CRN for this security group. - CRN *string `json:"crn,omitempty"` - - // The URL for this security group. - 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 *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 targets for the 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, 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, "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 -} - -// 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: -// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceEndpointGatewayReference -// - SecurityGroupTargetReferenceLoadBalancerReference -// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference -// - SecurityGroupTargetReferenceVPNServerReference -type SecurityGroupTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this bare metal server 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 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 name for this bare metal server network interface. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The CRN for this endpoint gateway. - 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, 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 - } - 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 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 and its snapshots. - AccessorBindings []ShareAccessorBindingReference `json:"accessor_bindings" validate:"required"` - - // The access protocols to allow for this share: - // - `nfs4`: NFSv4 is used to access this share via its associated share mount target. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AllowedAccessProtocols []string `json:"allowed_access_protocols" validate:"required"` - - // The transit encryption modes allowed for this share: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. - // - `stunnel`: Encrypted in transit using a connection via the installed stunnel - // client. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes" validate:"required"` - - // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: - // - `zonal`: The share's data will be available provided the `zone` of the share is - // available. Additionally, disasters affecting the zone may lead to data loss. - // - `regional`: The share's data will be available provided at least one zone in the - // region is available. Additionally, disasters affecting the entire region may lead - // to data loss. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AvailabilityMode *string `json:"availability_mode" validate:"required"` - - // The maximum bandwidth (in megabits per second) for the share. - Bandwidth *int64 `json:"bandwidth" 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 owner assigned to the file share at creation. - InitialOwner *ShareInitialOwner `json:"initial_owner" validate:"required"` - - // The maximum [input/output operations per second (IOPS) - // ](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for the file share. - // - // The maximum IOPS for a share as defined by the share's profile 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 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"` - - // 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 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"` - - // 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 (in gigabytes), excluding share snapshots. - 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 file share was cloned 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"` - - // The [storage - // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): - // - `1`: The first storage generation - // - `2`: The second storage generation - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - StorageGeneration *int64 `json:"storage_generation" validate:"required"` - - // The tags for this resource. - UserTags []string `json:"user_tags" validate:"required"` - - // The zone this file share resides in. - // - // This property will be absent for shares with an `availability_mode` of `regional`. - Zone *ZoneReference `json:"zone,omitempty"` -} - -// 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.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.AllowedAccessProtocols property. -const ( - ShareAllowedAccessProtocolsNfs4Const = "nfs4" -) - -// Constants associated with the Share.AllowedTransitEncryptionModes property. -const ( - ShareAllowedTransitEncryptionModesIpsecConst = "ipsec" - ShareAllowedTransitEncryptionModesNoneConst = "none" - ShareAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// Constants associated with the Share.AvailabilityMode property. -// The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: -// - `zonal`: The share's data will be available provided the `zone` of the share is -// available. Additionally, disasters affecting the zone may lead to data loss. -// - `regional`: The share's data will be available provided at least one zone in the -// region is available. Additionally, disasters affecting the entire region may lead -// to data loss. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareAvailabilityModeRegionalConst = "regional" - ShareAvailabilityModeZonalConst = "zonal" -) - -// 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, "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_access_protocols", &obj.AllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "availability_mode", &obj.AvailabilityMode) - if err != nil { - err = core.SDKErrorf(err, "", "availability_mode-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, "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.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, "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.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()) - 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, "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()) - 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.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, "storage_generation", &obj.StorageGeneration) - if err != nil { - err = core.SDKErrorf(err, "", "storage_generation-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 -} - -// ShareAccessorBinding : ShareAccessorBinding struct -type ShareAccessorBinding struct { - // The accessor for this share accessor binding. - 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. -// 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 *Deleted `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, 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 -} - -// ShareAccessorBindingCollection : ShareAccessorBindingCollection struct -type ShareAccessorBindingCollection struct { - // A page of accessor bindings for the share. - AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" 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"` -} - -// 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, 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 *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 -} - -// 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. - 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 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, 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, "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 -} - -// 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"` - - // A 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 -} - -// ShareLifecycleReason : ShareLifecycleReason struct -type ShareLifecycleReason struct { - // A reason code for this lifecycle state: - // - `cloning_failed`: The file share could not be cloned from the snapshot - // (contact IBM support) - // - `cloning_in_progress`: The file share is currently being cloned from the snapshot - // - `internal_error`: internal error (contact IBM support) - // - `origin_share_access_revoked`: The resource has been revoked by the share owner - // - `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"` - - // A 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: -// - `cloning_failed`: The file share could not be cloned from the snapshot -// (contact IBM support) -// - `cloning_in_progress`: The file share is currently being cloned from the snapshot -// - `internal_error`: internal error (contact IBM support) -// - `origin_share_access_revoked`: The resource has been revoked by the share owner -// - `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 ( - ShareLifecycleReasonCodeCloningFailedConst = "cloning_failed" - ShareLifecycleReasonCodeCloningInProgressConst = "cloning_in_progress" - 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: - // - // - `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 protocol used to access the share for this share mount target: - // - `nfs4`: NFSv4 will be used. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AccessProtocol *string `json:"access_protocol" 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. - // - `ipsec`: Encrypted in transit using an instance identity certificate. - // - `stunnel`: Encrypted in transit using a connection via the installed stunnel - // client. - // - // 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.AccessProtocol property. -// The protocol used to access the share for this share mount target: -// - `nfs4`: NFSv4 will be used. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareMountTargetAccessProtocolNfs4Const = "nfs4" -) - -// 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. -// - `ipsec`: Encrypted in transit using an instance identity certificate. -// - `stunnel`: Encrypted in transit using a connection via the installed stunnel -// client. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareMountTargetTransitEncryptionIpsecConst = "ipsec" - ShareMountTargetTransitEncryptionNoneConst = "none" - ShareMountTargetTransitEncryptionStunnelConst = "stunnel" -) - -// 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, "access_protocol", &obj.AccessProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "access_protocol-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 *PageLink `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // 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 - // except the last page. - Next *PageLink `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, 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, "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, 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 *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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(shareMountTargetPatch.Name) { - _patch["name"] = shareMountTargetPatch.Name - } - - return -} - -// ShareMountTargetPrototype : ShareMountTargetPrototype struct -// Models which "extend" this model: -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC -type ShareMountTargetPrototype struct { - // The protocol to use to access the share for this share mount target: - // - `nfs4`: NFSv4 will be used. - // - // The specified value must be listed in the share's `allowed_access_protocols`. - AccessProtocol *string `json:"access_protocol" validate:"required"` - - // The name for this share mount target. The name must not be used by another mount target for the file share. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc,omitempty"` -} - -// Constants associated with the ShareMountTargetPrototype.AccessProtocol property. -// The protocol to use to access the share for this share mount target: -// - `nfs4`: NFSv4 will be used. -// -// The specified value must be listed in the share's `allowed_access_protocols`. -const ( - ShareMountTargetPrototypeAccessProtocolNfs4Const = "nfs4" -) - -// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `ipsec`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( - ShareMountTargetPrototypeTransitEncryptionIpsecConst = "ipsec" - ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeTransitEncryptionStunnelConst = "stunnel" -) - -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, "access_protocol", &obj.AccessProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) - return - } - 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 *Deleted `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, 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 -} - -// 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"` - - // The 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 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"` - - // 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"` -} - -// 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" - ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled" -) - -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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - 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, - // `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The access protocols to allow for this share (replacing any existing access protocols). - // - // If the share has existing mount targets, the set of allowed access protocols must contain all `access_protocol` - // modes specified by existing mount targets. - // - // For this property to be updated, the `accessor_binding_role` must be `none`. - AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` - - // The transit encryption modes to allow for this share - // (replacing the existing allowed transit encryption modes). The specified transit encryption modes must contain all - // transit_encryption modes specified by existing mount targets. - // - // For this property to be updated, the `accessor_binding_role` must be `none`. - AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` - - // The maximum bandwidth (in megabits per second) for the share. - // - // For this property to be changed, the share `accessor_binding_role` must not be - // `accessor`, the share profile must not have a `bandwidth.type` of `dependent` or - // `fixed`, and the specified value must be within the `bandwidth` range of the share's profile. - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum input/output operations per second (IOPS) for the file share. - // - // 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`, the share profile must not have an `iops.type` of `dependent` or - // `fixed`, and the specified value must be within the `iops` range of the share's profile supported by the share's - // size. - 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`, with the following exceptions: - // - If the current profile family is `tiered`, the requested profile family may be - // `custom` or `defined_performance`. - // - If the current profile family is `custom`, the requested profile family may be - // `tiered` or `defined_performance`. Additionally, if requested profile family is - // `tiered`, then `iops` will be reset to a value based on the specified profile and - // current share size, and will become immutable. - // - If the current profile family is `defined_performance`, the requested profile - // family may be `tiered` or `custom`. Additionally, if requested profile family is - // `tiered`, then `iops` will be reset to a value based on the specified profile and - // current share size, and will become immutable. - // For this property to be changed, the share `accessor_binding_role` must not be - // `accessor`. - 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 every 15 minutes. - // - // 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 (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` - // - The share `replication_role` must not be `replica` - // - The share `accessor_binding_role` must not be `accessor`. - Size *int64 `json:"size,omitempty"` - - // The 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, -// `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. -const ( - SharePatchAccessControlModeSecurityGroupConst = "security_group" - SharePatchAccessControlModeVPCConst = "vpc" -) - -// Constants associated with the SharePatch.AllowedAccessProtocols property. -const ( - SharePatchAllowedAccessProtocolsNfs4Const = "nfs4" -) - -// Constants associated with the SharePatch.AllowedTransitEncryptionModes property. -const ( - SharePatchAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePatchAllowedTransitEncryptionModesNoneConst = "none" - SharePatchAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// 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, "allowed_access_protocols", &obj.AllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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) { - _patch = map[string]interface{}{} - if !core.IsNil(sharePatch.AccessControlMode) { - _patch["access_control_mode"] = sharePatch.AccessControlMode - } - if !core.IsNil(sharePatch.AllowedAccessProtocols) { - _patch["allowed_access_protocols"] = sharePatch.AllowedAccessProtocols - } - if !core.IsNil(sharePatch.AllowedTransitEncryptionModes) { - _patch["allowed_transit_encryption_modes"] = sharePatch.AllowedTransitEncryptionModes - } - if !core.IsNil(sharePatch.Bandwidth) { - _patch["bandwidth"] = sharePatch.Bandwidth - } - 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 -} - -// ShareProfile : ShareProfile struct -type ShareProfile struct { - // The possible allowed access protocols for a share with this profile. - AllowedAccessProtocols ShareProfileAllowedAccessProtocolsIntf `json:"allowed_access_protocols" validate:"required"` - - // The possible allowed transit encryption modes for a share with this profile. - AllowedTransitEncryptionModes ShareProfileAllowedTransitEncryptionModesIntf `json:"allowed_transit_encryption_modes" validate:"required"` - - // The data availability mode of a share with this profile. - AvailabilityModes ShareProfileAvailabilityModesIntf `json:"availability_modes" validate:"required"` - - // The permitted bandwidth (in megabits per second) for a share with this profile. - Bandwidth ShareProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // 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. - // - // 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. - 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"` - - // The storage generation for a share with this profile. - StorageGeneration ShareProfileStorageGenerationIntf `json:"storage_generation" validate:"required"` -} - -// 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 ( - ShareProfileFamilyCustomConst = "custom" - ShareProfileFamilyDefinedPerformanceConst = "defined_performance" - ShareProfileFamilyTieredConst = "tiered" -) - -// 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, "allowed_access_protocols", &obj.AllowedAccessProtocols, UnmarshalShareProfileAllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes, UnmarshalShareProfileAllowedTransitEncryptionModes) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "availability_modes", &obj.AvailabilityModes, UnmarshalShareProfileAvailabilityModes) - if err != nil { - err = core.SDKErrorf(err, "", "availability_modes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalShareProfileBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) - return - } - 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 - } - err = core.UnmarshalModel(m, "storage_generation", &obj.StorageGeneration, UnmarshalShareProfileStorageGeneration) - if err != nil { - err = core.SDKErrorf(err, "", "storage_generation-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileAllowedAccessProtocols : ShareProfileAllowedAccessProtocols struct -// Models which "extend" this model: -// - ShareProfileAllowedAccessProtocolsSubset -type ShareProfileAllowedAccessProtocols struct { - // The default allowed access protocol modes for shares with this profile. - Default []string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The possible allowed access protocols for shares with this profile: - // - `nfs4`: NFSv4 will be used. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values,omitempty"` -} - -// Constants associated with the ShareProfileAllowedAccessProtocols.Default property. -const ( - ShareProfileAllowedAccessProtocolsDefaultNfs4Const = "nfs4" -) - -// Constants associated with the ShareProfileAllowedAccessProtocols.Type property. -// The type for this profile field. -const ( - ShareProfileAllowedAccessProtocolsTypeSubsetConst = "subset" -) - -// Constants associated with the ShareProfileAllowedAccessProtocols.Values property. -const ( - ShareProfileAllowedAccessProtocolsValuesNfs4Const = "nfs4" -) - -func (*ShareProfileAllowedAccessProtocols) isaShareProfileAllowedAccessProtocols() bool { - return true -} - -type ShareProfileAllowedAccessProtocolsIntf interface { - isaShareProfileAllowedAccessProtocols() bool -} - -// UnmarshalShareProfileAllowedAccessProtocols unmarshals an instance of ShareProfileAllowedAccessProtocols from the specified map of raw messages. -func UnmarshalShareProfileAllowedAccessProtocols(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAllowedAccessProtocols) - 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 -} - -// ShareProfileAllowedTransitEncryptionModes : ShareProfileAllowedTransitEncryptionModes struct -// Models which "extend" this model: -// - ShareProfileAllowedTransitEncryptionModesSubset -type ShareProfileAllowedTransitEncryptionModes struct { - // The default allowed transit encryption modes for shares with this profile. - Default []string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The allowed [transit encryption modes](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for a share with this profile: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. - // - `stunnel`: Encrypted in transit using a connection via an stunnel connection. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values,omitempty"` -} - -// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Default property. -const ( - ShareProfileAllowedTransitEncryptionModesDefaultIpsecConst = "ipsec" - ShareProfileAllowedTransitEncryptionModesDefaultNoneConst = "none" - ShareProfileAllowedTransitEncryptionModesDefaultStunnelConst = "stunnel" -) - -// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Type property. -// The type for this profile field. -const ( - ShareProfileAllowedTransitEncryptionModesTypeSubsetConst = "subset" -) - -// Constants associated with the ShareProfileAllowedTransitEncryptionModes.Values property. -const ( - ShareProfileAllowedTransitEncryptionModesValuesIpsecConst = "ipsec" - ShareProfileAllowedTransitEncryptionModesValuesNoneConst = "none" - ShareProfileAllowedTransitEncryptionModesValuesStunnelConst = "stunnel" -) - -func (*ShareProfileAllowedTransitEncryptionModes) isaShareProfileAllowedTransitEncryptionModes() bool { - return true -} - -type ShareProfileAllowedTransitEncryptionModesIntf interface { - isaShareProfileAllowedTransitEncryptionModes() bool -} - -// UnmarshalShareProfileAllowedTransitEncryptionModes unmarshals an instance of ShareProfileAllowedTransitEncryptionModes from the specified map of raw messages. -func UnmarshalShareProfileAllowedTransitEncryptionModes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAllowedTransitEncryptionModes) - 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 -} - -// ShareProfileAvailabilityModes : ShareProfileAvailabilityModes struct -// Models which "extend" this model: -// - ShareProfileAvailabilityModesEnum -// - ShareProfileAvailabilityModesFixed -type ShareProfileAvailabilityModes struct { - // The default data availability mode for this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: - // - `zonal`: The data availability of this share is limited only to a single zone of a - // given region as provided by the `zone` of the share. - // - `regional`: The data availability of this share covers all zones in the region where - // the share is created. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values,omitempty"` - - // The value for this profile field. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the ShareProfileAvailabilityModes.Default property. -// The default data availability mode for this profile. -const ( - ShareProfileAvailabilityModesDefaultRegionalConst = "regional" - ShareProfileAvailabilityModesDefaultZonalConst = "zonal" -) - -// Constants associated with the ShareProfileAvailabilityModes.Type property. -// The type for this profile field. -const ( - ShareProfileAvailabilityModesTypeEnumConst = "enum" -) - -// Constants associated with the ShareProfileAvailabilityModes.Values property. -const ( - ShareProfileAvailabilityModesValuesRegionalConst = "regional" - ShareProfileAvailabilityModesValuesZonalConst = "zonal" -) - -// Constants associated with the ShareProfileAvailabilityModes.Value property. -// The value for this profile field. -const ( - ShareProfileAvailabilityModesValueRegionalConst = "regional" - ShareProfileAvailabilityModesValueZonalConst = "zonal" -) - -func (*ShareProfileAvailabilityModes) isaShareProfileAvailabilityModes() bool { - return true -} - -type ShareProfileAvailabilityModesIntf interface { - isaShareProfileAvailabilityModes() bool -} - -// UnmarshalShareProfileAvailabilityModes unmarshals an instance of ShareProfileAvailabilityModes from the specified map of raw messages. -func UnmarshalShareProfileAvailabilityModes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAvailabilityModes) - 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 - } - 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 -} - -// ShareProfileBandwidth : ShareProfileBandwidth struct -// Models which "extend" this model: -// - ShareProfileBandwidthRange -// - ShareProfileBandwidthDependent -// - ShareProfileBandwidthFixed -// - ShareProfileBandwidthEnum -// - ShareProfileBandwidthDependentRange -type ShareProfileBandwidth struct { - // 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 type for this profile field. - Type *string `json:"type,omitempty"` - - Value *int64 `json:"value,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the ShareProfileBandwidth.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthTypeRangeConst = "range" -) - -func (*ShareProfileBandwidth) isaShareProfileBandwidth() bool { - return true -} - -type ShareProfileBandwidthIntf interface { - isaShareProfileBandwidth() bool -} - -// UnmarshalShareProfileBandwidth unmarshals an instance of ShareProfileBandwidth from the specified map of raw messages. -func UnmarshalShareProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidth) - 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 - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacity : ShareProfileCapacity struct -// Models which "extend" this model: -// - ShareProfileCapacityFixed -// - ShareProfileCapacityEnum -// - ShareProfileCapacityRange -// - 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 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"` - - // 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"` -} - -// 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, "values", &obj.Values) - if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - 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 -} - -// ShareProfileCollection : ShareProfileCollection struct -type ShareProfileCollection 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 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, 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, 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 -} - -// ShareProfileIops : ShareProfileIops struct -// Models which "extend" this model: -// - ShareProfileIopsFixed -// - ShareProfileIopsRange -// - ShareProfileIopsEnum -// - ShareProfileIopsDependentRange -// - ShareProfileIopsDependent -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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 -} - -// ShareProfileStorageGeneration : ShareProfileStorageGeneration struct -// Models which "extend" this model: -// - ShareProfileStorageGenerationFixed -type ShareProfileStorageGeneration 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 ShareProfileStorageGeneration.Type property. -// The type for this profile field. -const ( - ShareProfileStorageGenerationTypeFixedConst = "fixed" -) - -func (*ShareProfileStorageGeneration) isaShareProfileStorageGeneration() bool { - return true -} - -type ShareProfileStorageGenerationIntf interface { - isaShareProfileStorageGeneration() bool -} - -// UnmarshalShareProfileStorageGeneration unmarshals an instance of ShareProfileStorageGeneration from the specified map of raw messages. -func UnmarshalShareProfileStorageGeneration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileStorageGeneration) - 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 -} - -// SharePrototype : SharePrototype struct -// Models which "extend" this model: -// - SharePrototypeShareBySize -// - SharePrototypeShareBySourceShare -// - SharePrototypeShareByOriginShare -// - SharePrototypeShareBySourceSnapshot -type SharePrototype struct { - // The transit encryption modes to allow for this share. If unspecified: - // - If share mount targets are specified, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - 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"` - - // 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. - // - // Replica file shares can only be created for shares with an `availability_mode` of - // `zonal`. - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // The tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // 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 access protocols to allow for this share. If unspecified: - // - If share mount targets are specified, only the access protocols specified by those - // share mount target will be allowed. - // - Otherwise, the default access protocols from the profile will be used. - AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` - - // The maximum bandwidth (in megabits per second) for the file share. - // - // If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this property is system-managed and must not - // be specified. Otherwise, the specified value must be within the `bandwidth` range of the share's profile. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `size` and `iops`](https://cloud.ibm.com/docs/vpc?topic=_TBD_). - Bandwidth *int64 `json:"bandwidth,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 maximum input/output operations per second (IOPS) for the file share. - // - // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be - // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the - // share's specified size. - 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"` - - // The size of the file share (in gigabytes), excluding share snapshots. - // - // The specified value must be within the permitted `capacity` range of the share's profile and supported by the - // share's specified IOPS. - Size *int64 `json:"size,omitempty"` - - // 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. - // - // This property must be specified if the share profile `availability_mode` is `zonal`, - // and must not be specified otherwise. - 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 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 already have a replica. - // - Not be a replica. - // - Have a `storage_generation` of `1`. - // - // 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"` - - // 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"` - - // The source snapshot to clone this file share from. - // - // 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. -const ( - SharePrototypeAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// 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" -) - -// Constants associated with the SharePrototype.AllowedAccessProtocols property. -const ( - SharePrototypeAllowedAccessProtocolsNfs4Const = "nfs4" -) - -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, "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.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, "allowed_access_protocols", &obj.AllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "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, "", "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.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()) - 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, "origin_share", &obj.OriginShare, UnmarshalShareIdentity) - if err != nil { - 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 -} - -// 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. -// -// Replica file shares can only be created for shares with an `availability_mode` of -// `zonal`. -type SharePrototypeShareContext struct { - // The transit encryption modes to allow for this share. If unspecified: - // - If share mount targets are specified, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` - - // The maximum input/output operations per second (IOPS) for the file share. - // - // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be - // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the - // share's specified size. - 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, and - // - have the same `storage_generation` as the share. - 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 every 15 minutes. - 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 tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // 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,omitempty"` -} - -// Constants associated with the SharePrototypeShareContext.AllowedTransitEncryptionModes property. -const ( - SharePrototypeShareContextAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeShareContextAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeShareContextAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string) (_model *SharePrototypeShareContext, err error) { - _model = &SharePrototypeShareContext{ - Profile: profile, - ReplicationCronSpec: core.StringPtr(replicationCronSpec), - } - 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, "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()) - 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 *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 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, 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 -} - -// 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"` -} - -// 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()) - 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"` - - // A 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 -} - -// 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. For shares with `availability_mode` of - // `regional`, this property will be absent. - Zone *ShareSnapshotZone `json:"zone,omitempty"` -} - -// 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, UnmarshalShareSnapshotZone) - 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"` - - // A 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 name for this share snapshot. The name must be unique among all snapshots for the file share. For this property - // to be changed, the share's `replication_role` must not be - // `replica`. - 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"` -} - -// 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, "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 ShareSnapshotPatch -func (shareSnapshotPatch *ShareSnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(shareSnapshotPatch.Name) { - _patch["name"] = shareSnapshotPatch.Name - } - 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"` - - // A 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 -} - -// ShareSnapshotZone : The zone this share snapshot resides in. For shares with `availability_mode` of -// `regional`, this property will be absent. -type ShareSnapshotZone 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"` -} - -// UnmarshalShareSnapshotZone unmarshals an instance of ShareSnapshotZone from the specified map of raw messages. -func UnmarshalShareSnapshotZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareSnapshotZone) - 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 -} - -// 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 { - // The usage constraints to be matched against the requested instance properties to - // determine compatibility. While bare metal servers cannot be provisioned from snapshots, - // an image or volume created from this snapshot will inherit its `allowed_use` value. - // - // Only present on bootable snapshots. The value of this property will be inherited from - // the source volume or source snapshot at snapshot creation, but can be changed. - AllowedUse *SnapshotAllowedUse `json:"allowed_use,omitempty"` - - // 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 [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"` - - // The 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"` - - // 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"` - - // 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 [storage - // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): - // - `1`: The first storage generation - // - `2`: The second storage generation - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - StorageGeneration *int64 `json:"storage_generation" 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" - SnapshotLifecycleStateUnusableConst = "unusable" - 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUse) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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, "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()) - 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.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()) - 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, "storage_generation", &obj.StorageGeneration) - if err != nil { - err = core.SDKErrorf(err, "", "storage_generation-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 -} - -// SnapshotAllowedUse : SnapshotAllowedUse struct -type SnapshotAllowedUse struct { - // The API version with which to evaluate the expressions. - ApiVersion *string `json:"api_version" validate:"required"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this snapshot. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server" validate:"required"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this - // snapshot. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance" validate:"required"` -} - -// UnmarshalSnapshotAllowedUse unmarshals an instance of SnapshotAllowedUse from the specified map of raw messages. -func UnmarshalSnapshotAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotAllowedUse) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotAllowedUsePatch : SnapshotAllowedUsePatch struct -type SnapshotAllowedUsePatch struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this snapshot. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this - // snapshot. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalSnapshotAllowedUsePatch unmarshals an instance of SnapshotAllowedUsePatch from the specified map of raw messages. -func UnmarshalSnapshotAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotAllowedUsePatch) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the SnapshotAllowedUsePatch -func (snapshotAllowedUsePatch *SnapshotAllowedUsePatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(snapshotAllowedUsePatch.ApiVersion) { - _patch["api_version"] = snapshotAllowedUsePatch.ApiVersion - } - if !core.IsNil(snapshotAllowedUsePatch.BareMetalServer) { - _patch["bare_metal_server"] = snapshotAllowedUsePatch.BareMetalServer - } - if !core.IsNil(snapshotAllowedUsePatch.Instance) { - _patch["instance"] = snapshotAllowedUsePatch.Instance - } - - return -} - -// SnapshotAllowedUsePrototype : SnapshotAllowedUsePrototype struct -type SnapshotAllowedUsePrototype struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query - // parameter value will be used. - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this snapshot. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this - // snapshot. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalSnapshotAllowedUsePrototype unmarshals an instance of SnapshotAllowedUsePrototype from the specified map of raw messages. -func UnmarshalSnapshotAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotAllowedUsePrototype) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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. - 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 { - // The clones for the snapshot. - 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 *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 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, 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, 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 -} - -// 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 *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 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, 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, "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 -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete) { - _patch["delete_snapshots_on_delete"] = snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete - } - if !core.IsNil(snapshotConsistencyGroupPatch.Name) { - _patch["name"] = snapshotConsistencyGroupPatch.Name - } - - 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. Each snapshot must specify a - // `source_volume` attached to the same virtual server instance, and all source volumes must have a - // `storage_generation` value of `1`. - 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 -} - -// SnapshotInstanceProfileCollection : SnapshotInstanceProfileCollection struct -type SnapshotInstanceProfileCollection struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // A page of instance profiles compatible with the snapshot. - InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `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"` -} - -// UnmarshalSnapshotInstanceProfileCollection unmarshals an instance of SnapshotInstanceProfileCollection from the specified map of raw messages. -func UnmarshalSnapshotInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotInstanceProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_profiles-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 *SnapshotInstanceProfileCollection) 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 -} - -// SnapshotPatch : SnapshotPatch struct -type SnapshotPatch struct { - // The usage constraints to be matched against the requested instance properties to - // determine compatibility. While bare metal servers cannot be provisioned from snapshots, - // an image or volume created from this snapshot will inherit its `allowed_use` value. - // - // Can only be specified for bootable snapshots. - AllowedUse *SnapshotAllowedUsePatch `json:"allowed_use,omitempty"` - - // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePatch) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_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.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) { - _patch = map[string]interface{}{} - if !core.IsNil(snapshotPatch.AllowedUse) { - _patch["allowed_use"] = snapshotPatch.AllowedUse.asPatch() - } - if !core.IsNil(snapshotPatch.Name) { - _patch["name"] = snapshotPatch.Name - } - if !core.IsNil(snapshotPatch.UserTags) { - _patch["user_tags"] = snapshotPatch.UserTags - } - - return -} - -// SnapshotPrototype : SnapshotPrototype struct -// Models which "extend" this model: -// - SnapshotPrototypeSnapshotBySourceVolume -// - SnapshotPrototypeSnapshotBySourceSnapshot -type SnapshotPrototype struct { - // The usage constraints to match against the requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified for bootable snapshots. - AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` - - // The 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) - return - } - 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 *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 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, 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 -} - -// 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"` -} - -// 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()) - 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 *Deleted `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, 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 -} - -// 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. - // - // 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. - // - // 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. -// -// 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" - 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 *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. - 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, 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, "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 -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(subnetPatch.Name) { - _patch["name"] = subnetPatch.Name - } - 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 -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 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, 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 -} - -// TrustedProfileIdentity : Identifies a trusted profile by a unique property. -// Models which "extend" this model: -// - TrustedProfileIdentityByID -// - TrustedProfileIdentityByCRN -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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// 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. - 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 -} - -// 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 -} - -// UpdatePublicAddressRangeOptions : The UpdatePublicAddressRange options. -type UpdatePublicAddressRangeOptions struct { - // The public address range identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public address range patch. - PublicAddressRangePatch map[string]interface{} `json:"PublicAddressRange_patch" validate:"required"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewUpdatePublicAddressRangeOptions : Instantiate UpdatePublicAddressRangeOptions -func (*VpcV1) NewUpdatePublicAddressRangeOptions(id string, publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions { - return &UpdatePublicAddressRangeOptions{ - ID: core.StringPtr(id), - PublicAddressRangePatch: publicAddressRangePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdatePublicAddressRangeOptions) SetID(id string) *UpdatePublicAddressRangeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPublicAddressRangePatch : Allow user to set PublicAddressRangePatch -func (_options *UpdatePublicAddressRangeOptions) SetPublicAddressRangePatch(publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions { - _options.PublicAddressRangePatch = publicAddressRangePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdatePublicAddressRangeOptions) SetHeaders(param map[string]string) *UpdatePublicAddressRangeOptions { - 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 file 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 -} - -// 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. - 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 -} - -// UpdateVPCRouteResponse : UpdateVPCRouteResponse struct -type UpdateVPCRouteResponse struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Action *string `json:"action" validate:"required"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin" validate:"required"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. - // - // If subnets are attached to the route's routing table, egress traffic from those - // subnets in this zone will be subject to this route. If this route's routing table - // has any of `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic - // from those ingress sources arriving in this zone will be subject to this route. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the UpdateVPCRouteResponse.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - UpdateVPCRouteResponseActionDelegateConst = "delegate" - UpdateVPCRouteResponseActionDelegateVPCConst = "delegate_vpc" - UpdateVPCRouteResponseActionDeliverConst = "deliver" - UpdateVPCRouteResponseActionDropConst = "drop" -) - -// Constants associated with the UpdateVPCRouteResponse.LifecycleState property. -// The lifecycle state of the route. -const ( - UpdateVPCRouteResponseLifecycleStateDeletingConst = "deleting" - UpdateVPCRouteResponseLifecycleStateFailedConst = "failed" - UpdateVPCRouteResponseLifecycleStatePendingConst = "pending" - UpdateVPCRouteResponseLifecycleStateStableConst = "stable" - UpdateVPCRouteResponseLifecycleStateSuspendedConst = "suspended" - UpdateVPCRouteResponseLifecycleStateUpdatingConst = "updating" - UpdateVPCRouteResponseLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the UpdateVPCRouteResponse.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 ( - UpdateVPCRouteResponseOriginServiceConst = "service" - UpdateVPCRouteResponseOriginUserConst = "user" -) - -// UnmarshalUpdateVPCRouteResponse unmarshals an instance of UpdateVPCRouteResponse from the specified map of raw messages. -func UnmarshalUpdateVPCRouteResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(UpdateVPCRouteResponse) - 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 -} - -// 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. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// Constants associated with the Vcpu.Architecture property. -// The VCPU architecture. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VcpuArchitectureAmd64Const = "amd64" - VcpuArchitectureS390xConst = "s390x" -) - -// Constants associated with the Vcpu.Manufacturer property. -// The VCPU manufacturer. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VcpuManufacturerAmdConst = "amd" - VcpuManufacturerIBMConst = "ibm" - VcpuManufacturerIntelConst = "intel" -) - -// 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. - 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/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. - 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 public address ranges attached to this VPC. - PublicAddressRanges []PublicAddressRangeReference `json:"public_address_ranges" 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. - // - // 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 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. -// -// 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" - 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, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRangeReference) - if err != nil { - err = core.SDKErrorf(err, "", "public_address_ranges-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 { - // 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. - 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 *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"` - - // A page 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, 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 - } - 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 -} - -// 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 -} - -// 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, -// 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 { - // 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. - 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"` -} - -// 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, 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 *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"` - - // A 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) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcdnsResolutionBindingPatch.Name) { - _patch["name"] = vpcdnsResolutionBindingPatch.Name - } - - 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` - // - // 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. - // - // - `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. - // - // 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. - // - // 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. - // - // 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. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `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 - // - 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. -// -// 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" - 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. Applies 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 -} - -// 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 -// - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - Code *string `json:"code" validate:"required"` - - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` - - // A 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// asPatch returns a generic map representation of the VPCIdentity -func (vpcIdentity *VPCIdentity) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcIdentity.ID) { - _patch["id"] = vpcIdentity.ID - } - if !core.IsNil(vpcIdentity.CRN) { - _patch["crn"] = vpcIdentity.CRN - } - if !core.IsNil(vpcIdentity.Href) { - _patch["href"] = vpcIdentity.Href - } - - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcPatch.Dns) { - _patch["dns"] = vpcPatch.Dns.asPatch() - } - if !core.IsNil(vpcPatch.Name) { - _patch["name"] = vpcPatch.Name - } - - 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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, 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 -} - -// 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: -// - VPNGatewayPolicyMode -// - VPNGatewayRouteMode -type VPNGateway struct { - // The 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"` - - // 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. - 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 mode for this 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. -// The mode for this VPN gateway. -const ( - VPNGatewayModePolicyConst = "policy" -) - -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 *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"` - - // A page 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, 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 - } - 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 -} - -// 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. - // - // 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. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The dead peer detection configuration. - 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 URL for this VPN gateway connection. - 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. - // - // 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. - 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"` - - // 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"` - - // The routing protocol 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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. -// -// 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" -) - -// 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. -// The routing protocol 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, 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()) - } - 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 : VPNGatewayConnectionCollection struct -type VPNGatewayConnectionCollection struct { - // A page of connections for the VPN gateway. - Connections []VPNGatewayConnectionIntf `json:"connections" 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"` -} - -// 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 - } - 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 *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 -} - -// VPNGatewayConnectionDpd : The dead peer detection configuration. -type VPNGatewayConnectionDpd struct { - // The dead peer detection action. - Action *string `json:"action" validate:"required"` - - // The dead peer detection interval in seconds. Must not be greater than `timeout`. - Interval *int64 `json:"interval" validate:"required"` - - // The dead peer detection timeout in seconds. Must not be less than `interval`. - Timeout *int64 `json:"timeout" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDpd.Action property. -// The dead peer detection action. -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 configuration. -type VPNGatewayConnectionDpdPatch struct { - // The dead peer detection action. - Action *string `json:"action,omitempty"` - - // The dead peer detection interval in seconds. Must not be greater than `timeout`. - Interval *int64 `json:"interval,omitempty"` - - // The dead peer detection timeout in seconds. Must not be less than `interval`. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. -// The dead peer detection action. -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 -} - -// 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 configuration. -type VPNGatewayConnectionDpdPrototype struct { - // The dead peer detection action. - Action *string `json:"action,omitempty"` - - // The dead peer detection interval in seconds. Must not be greater than `timeout`. - Interval *int64 `json:"interval,omitempty"` - - // The dead peer detection timeout in seconds. Must not be less than `interval`. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. -// The dead peer detection action. -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 URL for this IKE policy. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIkePolicyPatchIntf interface { - isaVPNGatewayConnectionIkePolicyPatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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: -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPrototype struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` - - // The URL for this IKE policy. - 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 URL for this IPsec policy. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIPsecPolicyPatchIntf interface { - isaVPNGatewayConnectionIPsecPolicyPatch() bool - asPatch() map[string]interface{} -} - -// 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 -} - -// 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: -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPrototype struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The URL for this IPsec policy. - 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 configuration. - 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. - // - `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"` -} - -// 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" -) - -// 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, "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()) - 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 - } - 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) { - _patch = map[string]interface{}{} - if !core.IsNil(vpnGatewayConnectionPatch.AdminStateUp) { - _patch["admin_state_up"] = vpnGatewayConnectionPatch.AdminStateUp - } - 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 -} - -// 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 configuration. - 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"` - - // 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"` - - // The routing protocol 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. -// The routing protocol 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.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()) - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this VPN gateway connection. - 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, 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 -} - -// 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. - // - // 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 []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` -} - -// 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" -) - -// 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"` - - // A 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"` - - // A 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"` - - // A 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"` - - // A 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. - // - // 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"` -} - -// 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. -// -// 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" -) - -// 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"` - - // A 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"` - - // A 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) { - _patch = map[string]interface{}{} - if !core.IsNil(vpnGatewayPatch.Name) { - _patch["name"] = vpnGatewayPatch.Name - } - - 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"` - - // The mode for this VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototype.Mode property. -// The mode for this 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 -} - -// 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"` - - // The 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 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. - 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 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" -) - -// 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. - // - // 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. - 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. -// -// 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" -) - -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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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 -// - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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`. - 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 { - // A page of clients of the VPN server. - Clients []VPNServerClient `json:"clients" 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"` -} - -// 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, 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 *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 -} - -// VPNServerCollection : VPNServerCollection struct -type VPNServerCollection 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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // A page 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, 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 - } - 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 -} - -// 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"` - - // A 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"` - - // A 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 to use for 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 to use for 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) { - _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 !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 -} - -// 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 *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 for the VPN server. - 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, 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, 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 -} - -// 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"` - - // A 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"` - - // A 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) { - _patch = map[string]interface{}{} - if !core.IsNil(vpnServerRoutePatch.Name) { - _patch["name"] = vpnServerRoutePatch.Name - } - - 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 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"` - - // 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.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 ( - 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.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()) - 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 *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"` - - // A page 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, 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 - } - 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 -} - -// 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"` - - // 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. - ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"` -} - -// Constants associated with the VirtualNetworkInterfacePatch.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 -// -// 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. -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) - 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 - } - 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 -} - -// AsPatch returns a generic map representation of the VirtualNetworkInterfacePatch -func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(virtualNetworkInterfacePatch.AllowIPSpoofing) { - _patch["allow_ip_spoofing"] = virtualNetworkInterfacePatch.AllowIPSpoofing - } - 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 -} - -// 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 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 usage constraints to be matched against the requested instance or bare metal server - // properties to determine compatibility. - // - // Only present for boot volumes. - AllowedUse *VolumeAllowedUse `json:"allowed_use,omitempty"` - - // 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. - // - // If the volume profile has a `bandwidth.type` of `dependent`, 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 - // 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 [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"` - - // 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 [storage - // generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles): - // - `1`: The first storage generation - // - `2`: The second storage generation - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - StorageGeneration *int64 `json:"storage_generation" 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.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 -// - `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, "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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUse) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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.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()) - 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, "storage_generation", &obj.StorageGeneration) - if err != nil { - err = core.SDKErrorf(err, "", "storage_generation-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 -} - -// VolumeAllowedUse : VolumeAllowedUse struct -type VolumeAllowedUse struct { - // The API version with which to evaluate the expressions. - ApiVersion *string `json:"api_version" validate:"required"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this volume. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server" validate:"required"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance" validate:"required"` -} - -// UnmarshalVolumeAllowedUse unmarshals an instance of VolumeAllowedUse from the specified map of raw messages. -func UnmarshalVolumeAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAllowedUse) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAllowedUsePatch : VolumeAllowedUsePatch struct -type VolumeAllowedUsePatch struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this volume. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalVolumeAllowedUsePatch unmarshals an instance of VolumeAllowedUsePatch from the specified map of raw messages. -func UnmarshalVolumeAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAllowedUsePatch) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the VolumeAllowedUsePatch -func (volumeAllowedUsePatch *VolumeAllowedUsePatch) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(volumeAllowedUsePatch.ApiVersion) { - _patch["api_version"] = volumeAllowedUsePatch.ApiVersion - } - if !core.IsNil(volumeAllowedUsePatch.BareMetalServer) { - _patch["bare_metal_server"] = volumeAllowedUsePatch.BareMetalServer - } - if !core.IsNil(volumeAllowedUsePatch.Instance) { - _patch["instance"] = volumeAllowedUsePatch.Instance - } - - return -} - -// VolumeAllowedUsePrototype : VolumeAllowedUsePrototype struct -type VolumeAllowedUsePrototype struct { - // The API version with which to evaluate the expressions. - // - // If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query - // parameter value will be used. - ApiVersion *string `json:"api_version,omitempty"` - - // The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in - // this volume. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variable is supported, corresponding - // to the `BareMetalServer` property: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled. - BareMetalServer *string `json:"bare_metal_server,omitempty"` - - // The expression that must be satisfied by the properties of a virtual server instance provisioned using this volume. - // - // If unspecified, the expression will be set to `true`. - // - // The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md), - // but does not support built-in functions and macros. In addition, the following variables are supported, - // corresponding to `Instance` properties: - // - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled - // - `gpu.count` (integer): The number of GPUs - // - `gpu.manufacturer` (string): The GPU manufacturer - // - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes) - // - `gpu.model` (string): The GPU model. - Instance *string `json:"instance,omitempty"` -} - -// UnmarshalVolumeAllowedUsePrototype unmarshals an instance of VolumeAllowedUsePrototype from the specified map of raw messages. -func UnmarshalVolumeAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAllowedUsePrototype) - err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion) - if err != nil { - err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) - if err != nil { - err = core.SDKErrorf(err, "", "instance-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"` - - // The configuration for the volume as a device in 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. - // - // 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. - // - // 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. -// -// 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" - VolumeAttachmentStatusDeletingConst = "deleting" - VolumeAttachmentStatusDetachingConst = "detaching" -) - -// 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" -) - -// 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 { - // The volume attachments for the instance. - 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" validate:"required"` -} - -// 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) { - _patch = map[string]interface{}{} - if !core.IsNil(volumeAttachmentPatch.DeleteVolumeOnInstanceDelete) { - _patch["delete_volume_on_instance_delete"] = volumeAttachmentPatch.DeleteVolumeOnInstanceDelete - } - if !core.IsNil(volumeAttachmentPatch.Name) { - _patch["name"] = volumeAttachmentPatch.Name - } - - 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"` - - // 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"` -} - -// 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 unattached volume. - 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 : 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 -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 bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 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. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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 *Deleted `json:"deleted,omitempty"` - - // The configuration for the volume as a device in 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, UnmarshalDeleted) - 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 -} - -// 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 *Deleted `json:"deleted,omitempty"` - - // The configuration for the volume as a device in 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. - // - // 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" -) - -// 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, UnmarshalDeleted) - 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 -} - -// 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. - 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"` - - // A page 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, 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 - } - 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 -} - -// 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"` - - // A 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" - VolumeHealthReasonCodeThrottledByInsufficientInstanceBandwidthConst = "throttled_by_insufficient_instance_bandwidth" -) - -// 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 -} - -// VolumeInstanceProfileCollection : VolumeInstanceProfileCollection struct -type VolumeInstanceProfileCollection struct { - // A link to the first page of resources. - First *PageLink `json:"first" validate:"required"` - - // A page of instance profiles compatible with the volume. - InstanceProfiles []InstanceProfileReference `json:"instance_profiles" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `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"` -} - -// UnmarshalVolumeInstanceProfileCollection unmarshals an instance of VolumeInstanceProfileCollection from the specified map of raw messages. -func UnmarshalVolumeInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeInstanceProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_profiles-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 *VolumeInstanceProfileCollection) 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 -} - -// VolumePatch : VolumePatch struct -type VolumePatch struct { - // The usage constraints to be matched against the requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified for boot volumes with an `attachment_state` of `unattached`. - AllowedUse *VolumeAllowedUsePatch `json:"allowed_use,omitempty"` - - // The maximum bandwidth (in megabits per second) for the volume. - // - // If specified, the volume profile must not have a `bandwidth.type` of `dependent`. - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // 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. 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 have the same - // `family` and `storage_generation` values 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 (replacing any - // existing tags). - 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePatch) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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) { - _patch = map[string]interface{}{} - if !core.IsNil(volumePatch.AllowedUse) { - _patch["allowed_use"] = volumePatch.AllowedUse.asPatch() - } - if !core.IsNil(volumePatch.Bandwidth) { - _patch["bandwidth"] = volumePatch.Bandwidth - } - if !core.IsNil(volumePatch.Capacity) { - _patch["capacity"] = volumePatch.Capacity - } - 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 -} - -// VolumeProfile : VolumeProfile struct -type VolumeProfile struct { - AdjustableCapacityStates *VolumeProfileAdjustableCapacityStates `json:"adjustable_capacity_states" validate:"required"` - - AdjustableIopsStates *VolumeProfileAdjustableIopsStates `json:"adjustable_iops_states" validate:"required"` - - Bandwidth VolumeProfileBandwidthIntf `json:"bandwidth" 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 - // [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"` - - Iops VolumeProfileIopsIntf `json:"iops" validate:"required"` - - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` - - // The storage generation value of volumes of this profile. - StorageGeneration *VolumeProfileStorageGenerationFixed `json:"storage_generation" 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" - 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, "bandwidth", &obj.Bandwidth, UnmarshalVolumeProfileBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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()) - 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, 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()) - return - } - err = core.UnmarshalModel(m, "storage_generation", &obj.StorageGeneration, UnmarshalVolumeProfileStorageGenerationFixed) - if err != nil { - err = core.SDKErrorf(err, "", "storage_generation-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 -} - -// VolumeProfileBandwidth : VolumeProfileBandwidth struct -// Models which "extend" this model: -// - VolumeProfileBandwidthFixed -// - VolumeProfileBandwidthRange -// - VolumeProfileBandwidthEnum -// - VolumeProfileBandwidthDependentRange -// - VolumeProfileBandwidthDependent -type VolumeProfileBandwidth 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 VolumeProfileBandwidth.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthTypeFixedConst = "fixed" -) - -func (*VolumeProfileBandwidth) isaVolumeProfileBandwidth() bool { - return true -} - -type VolumeProfileBandwidthIntf interface { - isaVolumeProfileBandwidth() bool -} - -// UnmarshalVolumeProfileBandwidth unmarshals an instance of VolumeProfileBandwidth from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidth) - 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 -} - -// 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. - 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 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, 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, 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 -} - -// 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 -// - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 -} - -// VolumeProfileStorageGenerationFixed : The storage generation value of volumes of this profile. -type VolumeProfileStorageGenerationFixed 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 VolumeProfileStorageGenerationFixed.Type property. -// The type for this profile field. -const ( - VolumeProfileStorageGenerationFixedTypeFixedConst = "fixed" -) - -// UnmarshalVolumeProfileStorageGenerationFixed unmarshals an instance of VolumeProfileStorageGenerationFixed from the specified map of raw messages. -func UnmarshalVolumeProfileStorageGenerationFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileStorageGenerationFixed) - 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 -} - -// VolumePrototype : VolumePrototype struct -// Models which "extend" this model: -// - VolumePrototypeVolumeByCapacity -// - VolumePrototypeVolumeBySourceSnapshot -type VolumePrototype struct { - // The maximum bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 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. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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.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, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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 usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_image`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // The maximum bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // 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"` - - // 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. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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 usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // The maximum bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // 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. - // - // 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. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 to use as a source for the volume's data. - // - // The specified snapshot may be in a different account, subject to IAM policies. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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 *Deleted `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, UnmarshalDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 *Deleted `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, 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 -} - -// 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"` - - // A 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 -} - -// 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"` - - // 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 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 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()) - 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 - } - 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 -} - -// ZoneCollection : ZoneCollection struct -type ZoneCollection struct { - // The zones for the region. - 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 - asPatch() map[string]interface{} -} - -// 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 -} - -// 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. - 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 -} - -// 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 { - // 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 *Deleted `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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 { - // 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 *Deleted `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, UnmarshalDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 -} - -// 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 { - // 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. - // - // A backup policy of type `instance` will create a backup of all volumes with a - // `storage_generation` value of `1` attached to the instance. - 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. -// -// A backup policy of type `instance` will create a backup of all volumes with a -// `storage_generation` value of `1` attached to the instance. -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 -} - -// 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 { - // 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 -} - -// 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 { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href" 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, 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 -} - -// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct -// This model "extends" BareMetalServerInitializationUserAccount -type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount 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 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. - // - // 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. - 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"` - - 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. -// -// 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" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. -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. - // - // 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. - 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"` - - 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. -// -// 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" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. -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"` - - // The 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 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"` - - // 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"` -} - -// 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 -} - -// 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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - 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"` - - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. -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"` - - 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. -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 empty. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the - // attached virtual network interface. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding - // network attachment. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the port speed is that of its - // corresponding network attachment. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of this bare metal server network interface. - 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"` - - 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. -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 empty. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the - // attached virtual network interface. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding - // network attachment. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the port speed is that of its - // corresponding network attachment. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of this bare metal server network interface. - 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"` - - 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. -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 empty. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the - // attached virtual network interface. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding - // network attachment. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the port speed is that of its - // corresponding network attachment. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of this bare metal server network interface. - 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"` - - 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. -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"` - - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. -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"` - - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. -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"` - - 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. -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"` - - InterfaceType *string `json:"interface_type,omitempty"` -} - -// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype.InterfaceType property. -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 { - // 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"` - - MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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 [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"` - - ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - 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, "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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) - 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, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - 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()) - 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 { - // 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"` - - MetadataService *BareMetalServerMetadataServicePrototype `json:"metadata_service,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 [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"` - - ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - 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, "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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalBareMetalServerMetadataServicePrototype) - 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, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - 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()) - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - 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 -} - -// 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 { - // 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 -} - -// 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 -// - 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 -} - -// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype : EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct -// This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct { - // The CRN for this private path service gateway. - 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 EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype.ResourceType property. -// The target resource type for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" -) - -// 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 (*EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// 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 -} - -// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTargetPrototype -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" validate:"required"` - - // The target resource type for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype.ResourceType property. -// The target resource type for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// 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 -} - -// 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"` -} - -// Constants associated with the EndpointGatewayTargetPrivatePathServiceGatewayReference.ResourceType property. -// The resource type. -const ( - EndpointGatewayTargetPrivatePathServiceGatewayReferenceResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" -) - -func (*EndpointGatewayTargetPrivatePathServiceGatewayReference) isaEndpointGatewayTarget() bool { - return true -} - -// 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, "", "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, 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 -} - -// 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 -} - -// 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 -// - 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 -} - -// 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 -// - 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 -} - -// 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 -// - 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 *Deleted `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 primary IP address of this bare metal server network interface. - 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, 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, "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 *Deleted `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 primary IP address of this instance network interface. - 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, 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, "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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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, "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 *Deleted `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"` - - // The virtual network interface for this instance network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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, 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, "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.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 -} - -// 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 *Deleted `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, 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 - } - 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 usage constraints to match against the requested instance or bare metal server properties to determine - // compatibility. - AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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 usage constraints to match against the requested instance or bare metal server properties to determine - // compatibility. - AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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, "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 { - // 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"` -} - -// 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, "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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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. - 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, "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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 -// - 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. - 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. - 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 - // - // 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. - 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 -// -// 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" - 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 - // - // 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 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 enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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 *Deleted `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, 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, "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"` - - // The 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 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"` - - // 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"` -} - -// 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 -} - -// 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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - 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 -} - -// 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 { - // 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 -} - -// 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 -// - 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 -} - -// 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 -// - 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 -} - -// 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 -// - 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 -} - -// 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 { - // 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 -} - -// InstanceProfileVcpuManufacturerDependent : The VCPU Manufacturer for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileVcpuManufacturer -type InstanceProfileVcpuManufacturerDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuManufacturerDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuManufacturerDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileVcpuManufacturerDependent) isaInstanceProfileVcpuManufacturer() bool { - return true -} - -// UnmarshalInstanceProfileVcpuManufacturerDependent unmarshals an instance of InstanceProfileVcpuManufacturerDependent from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuManufacturerDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuManufacturerDependent) - 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 -} - -// InstanceProfileVcpuManufacturerFixed : InstanceProfileVcpuManufacturerFixed struct -// This model "extends" InstanceProfileVcpuManufacturer -type InstanceProfileVcpuManufacturerFixed struct { - // 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 InstanceProfileVcpuManufacturerFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuManufacturerFixedTypeFixedConst = "fixed" -) - -// Constants associated with the InstanceProfileVcpuManufacturerFixed.Value property. -// The VCPU manufacturer for an instance with this profile. -const ( - InstanceProfileVcpuManufacturerFixedValueAmdConst = "amd" - InstanceProfileVcpuManufacturerFixedValueIBMConst = "ibm" - InstanceProfileVcpuManufacturerFixedValueIntelConst = "intel" -) - -func (*InstanceProfileVcpuManufacturerFixed) isaInstanceProfileVcpuManufacturer() bool { - return true -} - -// UnmarshalInstanceProfileVcpuManufacturerFixed unmarshals an instance of InstanceProfileVcpuManufacturerFixed from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuManufacturerFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuManufacturerFixed) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByCatalogOfferingConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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. -// -// The image's `user_data_format` must be `cloud_init`. -// Models which "extend" this model: -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByImage struct { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByImageConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceBySourceSnapshotConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceBySourceTemplateConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByVolumeConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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. -// -// The image's `user_data_format` must be `cloud_init`. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByImageConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotConfidentialComputeModeTdxConst = "tdx" -) - -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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateBySourceTemplateConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByImageInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 (such as - // `SHA256`). - // - // The length of this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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 CRN for this load balancer. - 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 -} - -// 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 { - // The URL for this load balancer. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The URL for this load balancer pool. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The URL for this load balancer listener. - 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer listener. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityIntf interface { - LoadBalancerListenerPolicyTargetPatchIntf - isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity -func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.ID) { - _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.ID - } - if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.Href) { - _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity.Href - } - - 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"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - 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 -} - -// 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 { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // 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"` -} - -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 -} - -// 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 -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer pool. - 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 -} - -// 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 -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id,omitempty"` - - // The URL for this load balancer listener. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityIntf interface { - LoadBalancerListenerPolicyTargetPrototypeIntf - isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity) - 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"` - - // The target listener. - // - // The target listener must be in this load balancer, and must not be the same as the - // listener in the URL. - 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. 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"` -} - -// 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 URL for this load balancer pool. - 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. 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"` -} - -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 -} - -// LoadBalancerListenerPolicyTargetLoadBalancerListenerReference : LoadBalancerListenerPolicyTargetLoadBalancerListenerReference struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerReference 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 load balancer listener. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerReference) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerReference) - 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 - } - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this load balancer pool. - 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref : LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerPoolFailsafePolicyTargetPatch -type LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref struct { - // The URL for this load balancer pool. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref -func (loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref.Href) { - _patch["href"] = loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref.Href - } - - return -} - -// LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID : LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerPoolFailsafePolicyTargetPatch -type LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID -func (loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID *LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID.ID) { - _patch["id"] = loadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID.ID - } - - return -} - -// LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype : LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype struct -// This model "extends" LoadBalancerPoolHealthMonitorPrototype -type LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype 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 to use. - // - // 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 LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototypeTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototypeTypeHTTPSConst = "https" -) - -// NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype, err error) { - _model = &LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype{ - 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 -} - -func (*LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype) - 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 -} - -// LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype : LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype struct -// This model "extends" LoadBalancerPoolHealthMonitorPrototype -type LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype 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"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototypeTypeTCPConst = "tcp" -) - -// NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype, err error) { - _model = &LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype{ - 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 -} - -func (*LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitorTypeHttphttps : LoadBalancerPoolHealthMonitorTypeHttphttps struct -// This model "extends" LoadBalancerPoolHealthMonitor -type LoadBalancerPoolHealthMonitorTypeHttphttps 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 used for health checks. - Type *string `json:"type" validate:"required"` - - // The health check URL path, in the format of an [origin-form request - // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). - URLPath *string `json:"url_path" validate:"required"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorTypeHttphttps.Type property. -// The protocol type used for health checks. -const ( - LoadBalancerPoolHealthMonitorTypeHttphttpsTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorTypeHttphttpsTypeHTTPSConst = "https" -) - -func (*LoadBalancerPoolHealthMonitorTypeHttphttps) isaLoadBalancerPoolHealthMonitor() bool { - return true -} - -// UnmarshalLoadBalancerPoolHealthMonitorTypeHttphttps unmarshals an instance of LoadBalancerPoolHealthMonitorTypeHttphttps from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorTypeHttphttps(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorTypeHttphttps) - 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 -} - -// LoadBalancerPoolHealthMonitorTypeTCP : LoadBalancerPoolHealthMonitorTypeTCP struct -// This model "extends" LoadBalancerPoolHealthMonitor -type LoadBalancerPoolHealthMonitorTypeTCP 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 used for health checks. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorTypeTCP.Type property. -// The protocol type used for health checks. -const ( - LoadBalancerPoolHealthMonitorTypeTCPTypeTCPConst = "tcp" -) - -func (*LoadBalancerPoolHealthMonitorTypeTCP) isaLoadBalancerPoolHealthMonitor() bool { - return true -} - -// UnmarshalLoadBalancerPoolHealthMonitorTypeTCP unmarshals an instance of LoadBalancerPoolHealthMonitorTypeTCP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorTypeTCP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorTypeTCP) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The URL for this load balancer pool. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -// - 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 -} - -// 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 -} - -// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity : Identifies a load balancer by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID -// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN -// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity struct { - // The unique identifier for this load balancer. - ID *string `json:"id,omitempty"` - - // The CRN for this load balancer. - CRN *string `json:"crn,omitempty"` - - // The URL for this load balancer. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { - return true -} - -type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityIntf interface { - LoadBalancerPoolMemberTargetPrototypeIntf - isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity -func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.ID) { - _patch["id"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.ID - } - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.CRN) { - _patch["crn"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.CRN - } - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.Href) { - _patch["href"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity.Href - } - - 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 *Deleted `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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetLoadBalancerReference : LoadBalancerPoolMemberTargetLoadBalancerReference struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetLoadBalancerReference 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 LoadBalancerPoolMemberTargetLoadBalancerReference.ResourceType property. -// The resource type. -const ( - LoadBalancerPoolMemberTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*LoadBalancerPoolMemberTargetLoadBalancerReference) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetLoadBalancerReference unmarshals an instance of LoadBalancerPoolMemberTargetLoadBalancerReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetLoadBalancerReference) - 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 -} - -// 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 -} - -// LoadBalancerProfileFailsafePolicyActionsDependent : The failsafe policy action configuration for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileFailsafePolicyActions -type LoadBalancerProfileFailsafePolicyActionsDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileFailsafePolicyActionsDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileFailsafePolicyActionsDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileFailsafePolicyActionsDependent) isaLoadBalancerProfileFailsafePolicyActions() bool { - return true -} - -// UnmarshalLoadBalancerProfileFailsafePolicyActionsDependent unmarshals an instance of LoadBalancerProfileFailsafePolicyActionsDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileFailsafePolicyActionsDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileFailsafePolicyActionsDependent) - 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 -} - -// LoadBalancerProfileFailsafePolicyActionsEnum : The failsafe policy action configuration for a load balancer with this profile. -// This model "extends" LoadBalancerProfileFailsafePolicyActions -type LoadBalancerProfileFailsafePolicyActionsEnum struct { - // The default failsafe policy action for this profile. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported failsafe policy actions. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Default property. -// The default failsafe policy action for this profile. -const ( - LoadBalancerProfileFailsafePolicyActionsEnumDefaultBypassConst = "bypass" - LoadBalancerProfileFailsafePolicyActionsEnumDefaultDropConst = "drop" - LoadBalancerProfileFailsafePolicyActionsEnumDefaultFailConst = "fail" - LoadBalancerProfileFailsafePolicyActionsEnumDefaultForwardConst = "forward" -) - -// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileFailsafePolicyActionsEnumTypeEnumConst = "enum" -) - -// Constants associated with the LoadBalancerProfileFailsafePolicyActionsEnum.Values property. -// A load balancer failsafe policy action: -// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. -// - `drop`: Drops requests. -// - `fail`: Fails requests with an HTTP `503` status code. -// - `forward`: Forwards requests to the `target` pool. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerProfileFailsafePolicyActionsEnumValuesBypassConst = "bypass" - LoadBalancerProfileFailsafePolicyActionsEnumValuesDropConst = "drop" - LoadBalancerProfileFailsafePolicyActionsEnumValuesFailConst = "fail" - LoadBalancerProfileFailsafePolicyActionsEnumValuesForwardConst = "forward" -) - -func (*LoadBalancerProfileFailsafePolicyActionsEnum) isaLoadBalancerProfileFailsafePolicyActions() bool { - return true -} - -// UnmarshalLoadBalancerProfileFailsafePolicyActionsEnum unmarshals an instance of LoadBalancerProfileFailsafePolicyActionsEnum from the specified map of raw messages. -func UnmarshalLoadBalancerProfileFailsafePolicyActionsEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileFailsafePolicyActionsEnum) - 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 -} - -// 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 no traffic being allowed. - 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"` - - // The 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 : A rule for ICMP, TCP and UDP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for ICMP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for TCP or UDP traffic. -// 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 the TCP or UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of the TCP or UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of the TCP or UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of the TCP or 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 network protocol. -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 : A rule for ICMP, TCP and UDP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for ICMP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for TCP or UDP traffic. -// 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 the TCP or UDP destination port range. - // - // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, - // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, - // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of the TCP or UDP source port range. - // - // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - // - // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` - // must also be unspecified, allowing traffic for all source ports. - 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 network protocol. -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 : A rule for ICMP, TCP and UDP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for ICMP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for TCP or UDP traffic. -// 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 the TCP or UDP destination port range. - // - // If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified, - // `destination_port_min` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - // - // If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified, - // `destination_port_max` must also be unspecified, allowing traffic for all destination ports. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of the TCP or UDP source port range. - // - // If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min` - // must also be unspecified, allowing traffic for all source ports. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP source port range. - // - // If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max` - // must also be unspecified, allowing traffic for all source ports. - 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 network protocol. -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 : A rule for ICMP, TCP and UDP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for ICMP traffic. -// 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 network protocol. - 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 network protocol. -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 : A rule for TCP or UDP traffic. -// 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 the TCP or UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of the TCP or UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of the TCP or UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of the TCP or 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 network protocol. -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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// 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 -// - 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, UnmarshalDeleted) - 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 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 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, 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 -} - -// 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 *Deleted `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, 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 -} - -// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNGatewayReference struct { - // 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 *Deleted `json:"deleted,omitempty"` - - // 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 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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 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 *Deleted `json:"deleted,omitempty"` - - // 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 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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 -} - -// 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 -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchVPNGatewayConnectionIdentity 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 (*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 -} - -// 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 -// - 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this VPN gateway connection. - 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, 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 -} - -// 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // The CRN for this security group. - 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 URL for this security group. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 ICMP, TCP and UDP traffic. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { - // The direction of traffic to allow. - Direction *string `json:"direction" validate:"required"` - - // 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 in that group matching this IP - // version. - IPVersion *string `json:"ip_version,omitempty"` - - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to allow. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The network protocol. -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.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - 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 -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { - // The direction of traffic to allow. - Direction *string `json:"direction" validate:"required"` - - // 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 in that group matching this IP - // version. - IPVersion *string `json:"ip_version,omitempty"` - - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,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 network protocol. - 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 allow. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The network protocol. -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, "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.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, "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 -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to allow. - Direction *string `json:"direction" validate:"required"` - - // 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 in that group matching this IP - // version. - IPVersion *string `json:"ip_version,omitempty"` - - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The inclusive upper bound of the TCP or 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 the TCP or 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 network protocol. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to allow. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The network protocol. -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.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - 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 -} - -// 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 -} - -// 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 { - // 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 -} - -// 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 -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The CRN for this security group. - CRN *string `json:"crn,omitempty"` - - // The URL for this security group. - 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 -} - -// 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 { - // 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 CRN for this security group. - CRN *string `json:"crn,omitempty"` - - // The URL for this security group. - 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 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 *Deleted `json:"deleted,omitempty"` - - // The URL for this security group. - 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, 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing ICMP, TCP and UDP traffic. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { - // The direction of traffic to allow. - 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 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 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 network protocol. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to allow. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The network protocol. -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 allow. - 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 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 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 network protocol. - 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 allow. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The network protocol. -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 allow. - 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 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 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 the TCP or UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the TCP or UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` - - // The network protocol. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to allow. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// 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 in that group matching this IP -// version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The network protocol. -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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceLoadBalancerReference 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 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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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 -} - -// 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 *Deleted `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, 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, "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 -} - -// 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 *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 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, 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 -} - -// 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 { - // 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: -// -// - 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 -// -// 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 protocol to use to access the share for this share mount target: - // - `nfs4`: NFSv4 will be used. - // - // The specified value must be listed in the share's `allowed_access_protocols`. - AccessProtocol *string `json:"access_protocol" validate:"required"` - - // The name for this share mount target. The name must not be used by another mount target for the file share. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.AccessProtocol property. -// The protocol to use to access the share for this share mount target: -// - `nfs4`: NFSv4 will be used. -// -// The specified value must be listed in the share's `allowed_access_protocols`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupAccessProtocolNfs4Const = "nfs4" -) - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `ipsec`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionIpsecConst = "ipsec" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionStunnelConst = "stunnel" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(accessProtocol string, transitEncryption string, virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ - AccessProtocol: core.StringPtr(accessProtocol), - TransitEncryption: core.StringPtr(transitEncryption), - 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, "access_protocol", &obj.AccessProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) - return - } - 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 protocol to use to access the share for this share mount target: - // - `nfs4`: NFSv4 will be used. - // - // The specified value must be listed in the share's `allowed_access_protocols`. - AccessProtocol *string `json:"access_protocol" validate:"required"` - - // The name for this share mount target. The name must not be used by another mount target for the file share. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - // - `stunnel`: Encrypted in transit using an stunnel connection. 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" validate:"required"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.AccessProtocol property. -// The protocol to use to access the share for this share mount target: -// - `nfs4`: NFSv4 will be used. -// -// The specified value must be listed in the share's `allowed_access_protocols`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCAccessProtocolNfs4Const = "nfs4" -) - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `ipsec`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -// - `stunnel`: Encrypted in transit using an stunnel connection. 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 ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionIpsecConst = "ipsec" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionStunnelConst = "stunnel" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(accessProtocol string, transitEncryption string, vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ - AccessProtocol: core.StringPtr(accessProtocol), - TransitEncryption: core.StringPtr(transitEncryption), - 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, "access_protocol", &obj.AccessProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "access_protocol-error", common.GetComponentInfo()) - return - } - 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"` - - // The 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 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"` - - // 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"` -} - -// 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" - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeEnabledConst = "enabled" -) - -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.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileAllowedAccessProtocolsSubset : ShareProfileAllowedAccessProtocolsSubset struct -// This model "extends" ShareProfileAllowedAccessProtocols -type ShareProfileAllowedAccessProtocolsSubset struct { - // The default allowed access protocol modes for shares with this profile. - Default []string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The possible allowed access protocols for shares with this profile: - // - `nfs4`: NFSv4 will be used. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Default property. -const ( - ShareProfileAllowedAccessProtocolsSubsetDefaultNfs4Const = "nfs4" -) - -// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Type property. -// The type for this profile field. -const ( - ShareProfileAllowedAccessProtocolsSubsetTypeSubsetConst = "subset" -) - -// Constants associated with the ShareProfileAllowedAccessProtocolsSubset.Values property. -const ( - ShareProfileAllowedAccessProtocolsSubsetValuesNfs4Const = "nfs4" -) - -func (*ShareProfileAllowedAccessProtocolsSubset) isaShareProfileAllowedAccessProtocols() bool { - return true -} - -// UnmarshalShareProfileAllowedAccessProtocolsSubset unmarshals an instance of ShareProfileAllowedAccessProtocolsSubset from the specified map of raw messages. -func UnmarshalShareProfileAllowedAccessProtocolsSubset(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAllowedAccessProtocolsSubset) - 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 -} - -// ShareProfileAllowedTransitEncryptionModesSubset : ShareProfileAllowedTransitEncryptionModesSubset struct -// This model "extends" ShareProfileAllowedTransitEncryptionModes -type ShareProfileAllowedTransitEncryptionModesSubset struct { - // The default allowed transit encryption modes for shares with this profile. - Default []string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The allowed [transit encryption modes](https://cloud.ibm.com/docs/vpc?topic=_TBD_) for a share with this profile: - // - `none`: Not encrypted in transit. - // - `ipsec`: Encrypted in transit using an instance identity certificate. - // - `stunnel`: Encrypted in transit using a connection via an stunnel connection. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Default property. -const ( - ShareProfileAllowedTransitEncryptionModesSubsetDefaultIpsecConst = "ipsec" - ShareProfileAllowedTransitEncryptionModesSubsetDefaultNoneConst = "none" - ShareProfileAllowedTransitEncryptionModesSubsetDefaultStunnelConst = "stunnel" -) - -// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Type property. -// The type for this profile field. -const ( - ShareProfileAllowedTransitEncryptionModesSubsetTypeSubsetConst = "subset" -) - -// Constants associated with the ShareProfileAllowedTransitEncryptionModesSubset.Values property. -const ( - ShareProfileAllowedTransitEncryptionModesSubsetValuesIpsecConst = "ipsec" - ShareProfileAllowedTransitEncryptionModesSubsetValuesNoneConst = "none" - ShareProfileAllowedTransitEncryptionModesSubsetValuesStunnelConst = "stunnel" -) - -func (*ShareProfileAllowedTransitEncryptionModesSubset) isaShareProfileAllowedTransitEncryptionModes() bool { - return true -} - -// UnmarshalShareProfileAllowedTransitEncryptionModesSubset unmarshals an instance of ShareProfileAllowedTransitEncryptionModesSubset from the specified map of raw messages. -func UnmarshalShareProfileAllowedTransitEncryptionModesSubset(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAllowedTransitEncryptionModesSubset) - 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 -} - -// ShareProfileAvailabilityModesEnum : The permitted data availability modes for a share with this profile. -// This model "extends" ShareProfileAvailabilityModes -type ShareProfileAvailabilityModesEnum struct { - // The default data availability mode for this profile. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The data [availability mode](https://cloud.ibm.com/docs/vpc?topic=_TBD_) of the share: - // - `zonal`: The data availability of this share is limited only to a single zone of a - // given region as provided by the `zone` of the share. - // - `regional`: The data availability of this share covers all zones in the region where - // the share is created. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the ShareProfileAvailabilityModesEnum.Default property. -// The default data availability mode for this profile. -const ( - ShareProfileAvailabilityModesEnumDefaultRegionalConst = "regional" - ShareProfileAvailabilityModesEnumDefaultZonalConst = "zonal" -) - -// Constants associated with the ShareProfileAvailabilityModesEnum.Type property. -// The type for this profile field. -const ( - ShareProfileAvailabilityModesEnumTypeEnumConst = "enum" -) - -// Constants associated with the ShareProfileAvailabilityModesEnum.Values property. -const ( - ShareProfileAvailabilityModesEnumValuesRegionalConst = "regional" - ShareProfileAvailabilityModesEnumValuesZonalConst = "zonal" -) - -func (*ShareProfileAvailabilityModesEnum) isaShareProfileAvailabilityModes() bool { - return true -} - -// UnmarshalShareProfileAvailabilityModesEnum unmarshals an instance of ShareProfileAvailabilityModesEnum from the specified map of raw messages. -func UnmarshalShareProfileAvailabilityModesEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAvailabilityModesEnum) - 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 -} - -// ShareProfileAvailabilityModesFixed : The data availability mode for a share with this profile is fixed. -// This model "extends" ShareProfileAvailabilityModes -type ShareProfileAvailabilityModesFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the ShareProfileAvailabilityModesFixed.Type property. -// The type for this profile field. -const ( - ShareProfileAvailabilityModesFixedTypeFixedConst = "fixed" -) - -// Constants associated with the ShareProfileAvailabilityModesFixed.Value property. -// The value for this profile field. -const ( - ShareProfileAvailabilityModesFixedValueRegionalConst = "regional" - ShareProfileAvailabilityModesFixedValueZonalConst = "zonal" -) - -func (*ShareProfileAvailabilityModesFixed) isaShareProfileAvailabilityModes() bool { - return true -} - -// UnmarshalShareProfileAvailabilityModesFixed unmarshals an instance of ShareProfileAvailabilityModesFixed from the specified map of raw messages. -func UnmarshalShareProfileAvailabilityModesFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileAvailabilityModesFixed) - 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 -} - -// ShareProfileBandwidthDependent : The permitted bandwidth for a share with this profile depends on its configuration. -// This model "extends" ShareProfileBandwidth -type ShareProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*ShareProfileBandwidthDependent) isaShareProfileBandwidth() bool { - return true -} - -// UnmarshalShareProfileBandwidthDependent unmarshals an instance of ShareProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalShareProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidthDependent) - 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 -} - -// ShareProfileBandwidthDependentRange : The permitted bandwidth range of a share with this profile depends on its configuration. -// This model "extends" ShareProfileBandwidth -type ShareProfileBandwidthDependentRange 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 ShareProfileBandwidthDependentRange.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*ShareProfileBandwidthDependentRange) isaShareProfileBandwidth() bool { - return true -} - -// UnmarshalShareProfileBandwidthDependentRange unmarshals an instance of ShareProfileBandwidthDependentRange from the specified map of raw messages. -func UnmarshalShareProfileBandwidthDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidthDependentRange) - 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 -} - -// ShareProfileBandwidthEnum : The permitted bandwidth values of a share with this profile. -// This model "extends" ShareProfileBandwidth -type ShareProfileBandwidthEnum 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 ShareProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*ShareProfileBandwidthEnum) isaShareProfileBandwidth() bool { - return true -} - -// UnmarshalShareProfileBandwidthEnum unmarshals an instance of ShareProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalShareProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidthEnum) - 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 -} - -// ShareProfileBandwidthFixed : The permitted bandwidth of a share with this profile is fixed. -// This model "extends" ShareProfileBandwidth -type ShareProfileBandwidthFixed 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 ShareProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileBandwidthFixed) isaShareProfileBandwidth() bool { - return true -} - -// UnmarshalShareProfileBandwidthFixed unmarshals an instance of ShareProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalShareProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidthFixed) - 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 -} - -// ShareProfileBandwidthRange : The permitted bandwidth range (in megabits per second) of a share with this profile. -// This model "extends" ShareProfileBandwidth -type ShareProfileBandwidthRange 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"` - - Value *int64 `json:"value,omitempty"` -} - -// Constants associated with the ShareProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - ShareProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*ShareProfileBandwidthRange) isaShareProfileBandwidth() bool { - return true -} - -// UnmarshalShareProfileBandwidthRange unmarshals an instance of ShareProfileBandwidthRange from the specified map of raw messages. -func UnmarshalShareProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileBandwidthRange) - 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 - } - 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 -} - -// 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 ( - 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 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, "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 -} - -// ShareProfileIopsDependent : The permitted IOPS for a share with this profile depends on its configuration. -// This model "extends" ShareProfileIops -type ShareProfileIopsDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileIopsDependent.Type property. -// The type for this profile field. -const ( - ShareProfileIopsDependentTypeDependentConst = "dependent" -) - -func (*ShareProfileIopsDependent) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsDependent unmarshals an instance of ShareProfileIopsDependent from the specified map of raw messages. -func UnmarshalShareProfileIopsDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsDependent) - 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 ( - 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// ShareProfileStorageGenerationFixed : The storage generation value of a share with this profile is fixed. -// This model "extends" ShareProfileStorageGeneration -type ShareProfileStorageGenerationFixed 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 ShareProfileStorageGenerationFixed.Type property. -// The type for this profile field. -const ( - ShareProfileStorageGenerationFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileStorageGenerationFixed) isaShareProfileStorageGeneration() bool { - return true -} - -// UnmarshalShareProfileStorageGenerationFixed unmarshals an instance of ShareProfileStorageGenerationFixed from the specified map of raw messages. -func UnmarshalShareProfileStorageGenerationFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileStorageGenerationFixed) - 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 -} - -// SharePrototypeShareByOriginShare : Create an accessor file share for an existing file share. The values for -// `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, -// `initial_owner`, `iops`, `profile`, `size`, and `zone` will be inherited from -// `origin_share`. -// -// Accessor file shares can only be created for shares with a `storage_generation` of `1`. -// This model "extends" SharePrototype -type SharePrototypeShareByOriginShare struct { - // The transit encryption modes to allow for this share. If unspecified: - // - If share mount targets are specified, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - 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"` - - // The tags for this resource. - UserTags []string `json:"user_tags,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" validate:"required"` - - // The resource group to use. If unspecified, the resource group from - // the origin share will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} - -// Constants associated with the SharePrototypeShareByOriginShare.AllowedTransitEncryptionModes property. -const ( - SharePrototypeShareByOriginShareAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeShareByOriginShareAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeShareByOriginShareAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// 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 - } - 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 -} - -// 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, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - 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"` - - // The tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // 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 access protocols to allow for this share. If unspecified: - // - If share mount targets are specified, only the access protocols specified by those - // share mount target will be allowed. - // - Otherwise, the default access protocols from the profile will be used. - AllowedAccessProtocols []string `json:"allowed_access_protocols,omitempty"` - - // The maximum bandwidth (in megabits per second) for the file share. - // - // If the share profile has a `bandwidth.type` of `dependent` or `fixed`, this property is system-managed and must not - // be specified. Otherwise, the specified value must be within the `bandwidth` range of the share's profile. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `size` and `iops`](https://cloud.ibm.com/docs/vpc?topic=_TBD_). - Bandwidth *int64 `json:"bandwidth,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 maximum input/output operations per second (IOPS) for the file share. - // - // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be - // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the - // share's specified size. - 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 of the file share (in gigabytes), excluding share snapshots. - // - // The specified value must be within the permitted `capacity` range of the share's profile and supported by the - // share's specified IOPS. - Size *int64 `json:"size" validate:"required"` - - // 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. - // - // This property must be specified if the share profile `availability_mode` is `zonal`, - // and must not be specified otherwise. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// Constants associated with the SharePrototypeShareBySize.AllowedTransitEncryptionModes property. -const ( - SharePrototypeShareBySizeAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeShareBySizeAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeShareBySizeAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// 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" -) - -// Constants associated with the SharePrototypeShareBySize.AllowedAccessProtocols property. -const ( - SharePrototypeShareBySizeAllowedAccessProtocolsNfs4Const = "nfs4" -) - -// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { - _model = &SharePrototypeShareBySize{ - Profile: profile, - 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, "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.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, "allowed_access_protocols", &obj.AllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-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, "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, "", "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.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 -} - -// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for -// `access_control_mode`, `allowed_access_protocols`, `bandwidth`, `encryption_key`, -// `initial_owner`, and `size` will be inherited from the `source_share`. -// -// Replica file shares can only be created if the source share has a `storage_generation` of -// `1`. -// This model "extends" SharePrototype -type SharePrototypeShareBySourceShare struct { - // The transit encryption modes to allow for this share. If unspecified: - // - If share mount targets are specified, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - 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"` - - // The tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // 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 maximum input/output operations per second (IOPS) for the file share. - // - // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be - // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the - // share's specified size. - 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, and - // - have the same `storage_generation` as the source share. - 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 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 - // 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. - // - Not be a replica. - // - Have a `storage_generation` of `1`. - // - // 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"` - - // 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. - // - // This property must be specified if the share profile `availability_mode` is `zonal`, - // and must not be specified otherwise. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// Constants associated with the SharePrototypeShareBySourceShare.AllowedTransitEncryptionModes property. -const ( - SharePrototypeShareBySourceShareAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeShareBySourceShareAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeShareBySourceShareAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { - _model = &SharePrototypeShareBySourceShare{ - Profile: profile, - 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, "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.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.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`, -// `bandwidth`, `initial_owner` and `zone` will be inherited from `source_snapshot`. -// -// Shares can only be created from a source snapshot if the source share has a -// `storage_generation` of `1`. -// This model "extends" SharePrototype -type SharePrototypeShareBySourceSnapshot struct { - // The transit encryption modes to allow for this share. If unspecified: - // - If share mount targets are specified, then only transit encryption modes - // specified by those share mount target will be allowed. - // - Otherwise, the default allowed transit encryption modes from the profile will be - // used. - 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"` - - // The tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The access protocols to allow for this share. If unspecified: - // - If share mount targets are specified, only the access protocols specified by those - // share mount target will be allowed. - // - Otherwise, the default access protocols from the profile will be used. - AllowedAccessProtocols []string `json:"allowed_access_protocols,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 maximum input/output operations per second (IOPS) for the file share. - // - // If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be - // specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the - // share's specified size. - 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, and - // - have the same `storage_generation` as the source snapshot. - 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 to clone this file share from. - // - // 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. -const ( - SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesIpsecConst = "ipsec" - SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesNoneConst = "none" - SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesStunnelConst = "stunnel" -) - -// Constants associated with the SharePrototypeShareBySourceSnapshot.AllowedAccessProtocols property. -const ( - SharePrototypeShareBySourceSnapshotAllowedAccessProtocolsNfs4Const = "nfs4" -) - -// 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.UnmarshalPrimitive(m, "allowed_access_protocols", &obj.AllowedAccessProtocols) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_access_protocols-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.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()) - 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_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 -} - -// 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, "", "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)) - 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. Each snapshot must specify a - // `source_volume` attached to the same virtual server instance, and all source volumes must have a - // `storage_generation` value of `1`. - 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 { - // The usage constraints to match against the requested instance or bare metal server properties to determine - // compatibility. - // - // Can only be specified for bootable snapshots. - AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` - - // The 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) - return - } - 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 { - // The usage constraints to match against the requested instance or bare metal server properties to determine - // compatibility. - // - // Can only be specified for bootable snapshots. - AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"` - - // The 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, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo()) - return - } - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 TrustedProfileIdentityByCRN struct { - // The CRN for this trusted profile. - CRN *string `json:"crn" validate:"required"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*TrustedProfileIdentityByCRN) isaTrustedProfileIdentity() bool { - return true -} - -// 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TrustedProfileIdentityByID : TrustedProfileIdentityByID struct -// This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityByID struct { - // The unique identifier for this trusted profile. - ID *string `json:"id" validate:"required"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*TrustedProfileIdentityByID) isaTrustedProfileIdentity() bool { - return true -} - -// 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()) - 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` - // - // 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. - 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` - // - // 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. - // - // 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. - // - // 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. - 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` - // - // 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. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `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 - // - 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. Applies 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// asPatch returns a generic map representation of the VPCIdentityByCRN -func (vpcIdentityByCRN *VPCIdentityByCRN) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcIdentityByCRN.CRN) { - _patch["crn"] = vpcIdentityByCRN.CRN - } - - 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 -} - -// asPatch returns a generic map representation of the VPCIdentityByHref -func (vpcIdentityByHref *VPCIdentityByHref) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcIdentityByHref.Href) { - _patch["href"] = vpcIdentityByHref.Href - } - - 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 -} - -// asPatch returns a generic map representation of the VPCIdentityByID -func (vpcIdentityByID *VPCIdentityByID) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(vpcIdentityByID.ID) { - _patch["id"] = vpcIdentityByID.ID - } - - 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 { - // The URL for this IKE policy. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The URL for this IKE policy. - 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 URL for this IPsec policy. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The URL for this IPsec policy. - 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 -} - -// 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: -// - 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 -} - -// 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. - // - // 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. - 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 URL for this VPN gateway connection. - 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. - // - // 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. - 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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. -// -// 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" -) - -// 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"` - - // 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"` - - // The routing protocol 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. -// The routing protocol 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.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()) - 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. - // - // 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. - 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 URL for this VPN gateway connection. - 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. - // - // 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. - 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"` - - // 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"` - - // The routing protocol 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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. -// -// 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" -) - -// 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. -// The routing protocol 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 { - // The 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"` - - // 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. - 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 mode for this 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. -// The mode for this 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"` - - // The mode for this VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// The mode for this VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" -) - -// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf, mode string) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ - Subnet: subnet, - Mode: core.StringPtr(mode), - } - 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 mode for this VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// The mode for this 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 { - // The 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"` - - // 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. - 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 mode for this 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. -// The mode for this 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. - // - // 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). - 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. -// -// 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" -) - -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. - // - // 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. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` -} - -// 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" -) - -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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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: -// - 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 *Deleted `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, 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 -} - -// 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 bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 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. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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 -} - -// VolumeProfileBandwidthDependent : The maximum bandwidth (in Mbps) of a volume with this profile depends on its configuration. -// This model "extends" VolumeProfileBandwidth -type VolumeProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VolumeProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*VolumeProfileBandwidthDependent) isaVolumeProfileBandwidth() bool { - return true -} - -// UnmarshalVolumeProfileBandwidthDependent unmarshals an instance of VolumeProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidthDependent) - 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 -} - -// VolumeProfileBandwidthDependentRange : The maximum bandwidth (in Mbps) of a volume with this profile varies depending on its configuration. -// This model "extends" VolumeProfileBandwidth -type VolumeProfileBandwidthDependentRange 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 VolumeProfileBandwidthDependentRange.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*VolumeProfileBandwidthDependentRange) isaVolumeProfileBandwidth() bool { - return true -} - -// UnmarshalVolumeProfileBandwidthDependentRange unmarshals an instance of VolumeProfileBandwidthDependentRange from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidthDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidthDependentRange) - 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 -} - -// VolumeProfileBandwidthEnum : The available maximum bandwidth values (in Mbps) of a volume with this profile. -// This model "extends" VolumeProfileBandwidth -type VolumeProfileBandwidthEnum 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 VolumeProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*VolumeProfileBandwidthEnum) isaVolumeProfileBandwidth() bool { - return true -} - -// UnmarshalVolumeProfileBandwidthEnum unmarshals an instance of VolumeProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidthEnum) - 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 -} - -// VolumeProfileBandwidthFixed : The maximum bandwidth (in Mbps) of a volume with this profile is fixed. -// This model "extends" VolumeProfileBandwidth -type VolumeProfileBandwidthFixed 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 VolumeProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*VolumeProfileBandwidthFixed) isaVolumeProfileBandwidth() bool { - return true -} - -// UnmarshalVolumeProfileBandwidthFixed unmarshals an instance of VolumeProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidthFixed) - 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 -} - -// VolumeProfileBandwidthRange : The maximum bandwidth range (in Mbps) of a volume with this profile. -// This model "extends" VolumeProfileBandwidth -type VolumeProfileBandwidthRange 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 VolumeProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - VolumeProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*VolumeProfileBandwidthRange) isaVolumeProfileBandwidth() bool { - return true -} - -// UnmarshalVolumeProfileBandwidthRange unmarshals an instance of VolumeProfileBandwidthRange from the specified map of raw messages. -func UnmarshalVolumeProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileBandwidthRange) - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // The maximum bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 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. - // - // 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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.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 bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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"` - - // 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 to use as a source for the volume's data. - // - // The specified snapshot may be in a different account, subject to IAM policies. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -// - 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. - 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. - 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 - // - // 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. - 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 -// -// 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" - 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. - 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. - 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 - // - // 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. - 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 -// -// 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" - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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. - // 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"` - - // 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 this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -// 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, "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()) - 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()) - 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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 { - 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. - 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"` - - // 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"` - - // 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"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for this 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 - // [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account). - // - // 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"` - - 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"` - - // The [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"` -} - -// 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" - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeTdxConst = "tdx" -) - -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.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()) - 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, "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, "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 -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct { - // The URL for this load balancer listener. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref -func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref.Href) { - _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref.Href - } - - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID -func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID.ID) { - _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID.ID - } - - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The URL for this load balancer pool. - 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref struct { - // The URL for this load balancer listener. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentityLoadBalancerListenerIdentityByID) - 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 URL for this load balancer pool. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 -} - -// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity -type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN struct { - // The CRN for this load balancer. - CRN *string `json:"crn" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) - 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 LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN -func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN.CRN) { - _patch["crn"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByCRN.CRN - } - - return -} - -// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity -type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref struct { - // The URL for this load balancer. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref -func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref.Href) { - _patch["href"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByHref.Href - } - - return -} - -// LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID : LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity -type LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID struct { - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) - 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 -} - -// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID -func (loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID *LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID.ID) { - _patch["id"] = loadBalancerPoolMemberTargetPrototypeLoadBalancerIdentityLoadBalancerIdentityByID.ID - } - - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The URL for this VPN gateway connection. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototype() bool { - return true -} - -// 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - // - `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"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototype() bool { - return true -} - -// 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity -type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The URL for this VPN gateway connection. - Href *string `json:"href" validate:"required"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototype() bool { - return true -} - -// 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity -type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototype() bool { - return true -} - -// 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The CRN for this security group. - 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 -} - -// 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 { - // The URL for this security group. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // The CRN for this security group. - 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 URL for this security group. - 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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 { - // 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 -} - -// 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. - // - // 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. - 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 URL for this VPN gateway connection. - 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. - // - // 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. - 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"` - - // 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"` - - // The routing protocol 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. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -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. -// -// 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" -) - -// 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. -// The routing protocol 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.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()) - 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 bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 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. - // - // 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum bandwidth (in megabits per second) for the volume. - // - // If the volume profile has a `bandwidth.type` of `dependent`, this property is system-managed and must not be - // specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [`iops` - // and - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. - // - // If the volume profile has a `iops.type` of `dependent`, this property is system-managed and must not be specified. - // - // Provided the property is user-managed, if it is unspecified, its value will be set based on the specified [ - // `capacity`](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api). - 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) 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 usage constraints to be matched against requested instance or bare metal server - // properties to determine compatibility. - // - // Can only be specified if `source_snapshot` is bootable. If not specified, the value of - // this property will be inherited from the `source_snapshot`. - AllowedUse *VolumeAllowedUsePrototype `json:"allowed_use,omitempty"` - - // 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"` - - // 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 to use as a source for the volume's data. - // - // The specified snapshot may be in a different account, subject to IAM policies. - // - // To create a volume from a `source_snapshot`, the volume profile and the - // source snapshot must have the same `storage_generation` value. - 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, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalVolumeAllowedUsePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_use-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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// ImageBareMetalServerProfilesPager can be used to simplify the use of the "ListImageBareMetalServerProfiles" method. -type ImageBareMetalServerProfilesPager struct { - hasNext bool - options *ListImageBareMetalServerProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewImageBareMetalServerProfilesPager returns a new ImageBareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewImageBareMetalServerProfilesPager(options *ListImageBareMetalServerProfilesOptions) (pager *ImageBareMetalServerProfilesPager, 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 ListImageBareMetalServerProfilesOptions = *options - pager = &ImageBareMetalServerProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ImageBareMetalServerProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ImageBareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfileReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListImageBareMetalServerProfilesWithContext(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.BareMetalServerProfiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ImageBareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfileReference, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerProfileReference - 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 *ImageBareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfileReference, 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 *ImageBareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfileReference, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ImageInstanceProfilesPager can be used to simplify the use of the "ListImageInstanceProfiles" method. -type ImageInstanceProfilesPager struct { - hasNext bool - options *ListImageInstanceProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewImageInstanceProfilesPager returns a new ImageInstanceProfilesPager instance. -func (vpc *VpcV1) NewImageInstanceProfilesPager(options *ListImageInstanceProfilesOptions) (pager *ImageInstanceProfilesPager, 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 ListImageInstanceProfilesOptions = *options - pager = &ImageInstanceProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ImageInstanceProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ImageInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListImageInstanceProfilesWithContext(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.InstanceProfiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ImageInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { - for pager.HasNext() { - var nextPage []InstanceProfileReference - 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 *ImageInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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 *ImageInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 - 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 -} - -// 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 -} - -// 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 -} - -// LoadBalancerPoolMembersPager can be used to simplify the use of the "ListLoadBalancerPoolMembers" method. -type LoadBalancerPoolMembersPager struct { - hasNext bool - options *ListLoadBalancerPoolMembersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewLoadBalancerPoolMembersPager returns a new LoadBalancerPoolMembersPager instance. -func (vpc *VpcV1) NewLoadBalancerPoolMembersPager(options *ListLoadBalancerPoolMembersOptions) (pager *LoadBalancerPoolMembersPager, 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 ListLoadBalancerPoolMembersOptions = *options - pager = &LoadBalancerPoolMembersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancerPoolMembersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *LoadBalancerPoolMembersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerPoolMember, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListLoadBalancerPoolMembersWithContext(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.Members - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *LoadBalancerPoolMembersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerPoolMember, err error) { - for pager.HasNext() { - var nextPage []LoadBalancerPoolMember - 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 *LoadBalancerPoolMembersPager) GetNext() (page []LoadBalancerPoolMember, 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 *LoadBalancerPoolMembersPager) GetAll() (allItems []LoadBalancerPoolMember, 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// PublicAddressRangesPager can be used to simplify the use of the "ListPublicAddressRanges" method. -type PublicAddressRangesPager struct { - hasNext bool - options *ListPublicAddressRangesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewPublicAddressRangesPager returns a new PublicAddressRangesPager instance. -func (vpc *VpcV1) NewPublicAddressRangesPager(options *ListPublicAddressRangesOptions) (pager *PublicAddressRangesPager, 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 ListPublicAddressRangesOptions = *options - pager = &PublicAddressRangesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *PublicAddressRangesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *PublicAddressRangesPager) GetNextWithContext(ctx context.Context) (page []PublicAddressRange, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListPublicAddressRangesWithContext(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.PublicAddressRanges - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *PublicAddressRangesPager) GetAllWithContext(ctx context.Context) (allItems []PublicAddressRange, err error) { - for pager.HasNext() { - var nextPage []PublicAddressRange - 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 *PublicAddressRangesPager) GetNext() (page []PublicAddressRange, 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 *PublicAddressRangesPager) GetAll() (allItems []PublicAddressRange, 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 - 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 - 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 -} - -// 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 -} - -// 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 -} - -// SnapshotInstanceProfilesPager can be used to simplify the use of the "ListSnapshotInstanceProfiles" method. -type SnapshotInstanceProfilesPager struct { - hasNext bool - options *ListSnapshotInstanceProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSnapshotInstanceProfilesPager returns a new SnapshotInstanceProfilesPager instance. -func (vpc *VpcV1) NewSnapshotInstanceProfilesPager(options *ListSnapshotInstanceProfilesOptions) (pager *SnapshotInstanceProfilesPager, 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 ListSnapshotInstanceProfilesOptions = *options - pager = &SnapshotInstanceProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotInstanceProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSnapshotInstanceProfilesWithContext(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.InstanceProfiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SnapshotInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { - for pager.HasNext() { - var nextPage []InstanceProfileReference - 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 *SnapshotInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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 *SnapshotInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// VolumeInstanceProfilesPager can be used to simplify the use of the "ListVolumeInstanceProfiles" method. -type VolumeInstanceProfilesPager struct { - hasNext bool - options *ListVolumeInstanceProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVolumeInstanceProfilesPager returns a new VolumeInstanceProfilesPager instance. -func (vpc *VpcV1) NewVolumeInstanceProfilesPager(options *ListVolumeInstanceProfilesOptions) (pager *VolumeInstanceProfilesPager, 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 ListVolumeInstanceProfilesOptions = *options - pager = &VolumeInstanceProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumeInstanceProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumeInstanceProfilesPager) GetNextWithContext(ctx context.Context) (page []InstanceProfileReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVolumeInstanceProfilesWithContext(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.InstanceProfiles - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VolumeInstanceProfilesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceProfileReference, err error) { - for pager.HasNext() { - var nextPage []InstanceProfileReference - 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 *VolumeInstanceProfilesPager) GetNext() (page []InstanceProfileReference, 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 *VolumeInstanceProfilesPager) GetAll() (allItems []InstanceProfileReference, 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 -} - -// 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 []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 { - 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 []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 *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 []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 -} - -// 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 -} - -// 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 -} - -// IkePolicyConnectionsPager can be used to simplify the use of the "ListIkePolicyConnections" method. -type IkePolicyConnectionsPager struct { - hasNext bool - options *ListIkePolicyConnectionsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// 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 ListIkePolicyConnectionsOptions = *options - pager = &IkePolicyConnectionsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IkePolicyConnectionsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -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.ListIkePolicyConnectionsWithContext(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.Connections - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { - for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf - 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 *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 *IkePolicyConnectionsPager) 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 { - 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 -} - -// IpsecPolicyConnectionsPager can be used to simplify the use of the "ListIpsecPolicyConnections" method. -type IpsecPolicyConnectionsPager struct { - hasNext bool - options *ListIpsecPolicyConnectionsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// 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 ListIpsecPolicyConnectionsOptions = *options - pager = &IpsecPolicyConnectionsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IpsecPolicyConnectionsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -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.ListIpsecPolicyConnectionsWithContext(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.Connections - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { - for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf - 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 *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 *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 -} - -// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. -type VPNGatewayConnectionsPager struct { - hasNext bool - options *ListVPNGatewayConnectionsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// 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 ListVPNGatewayConnectionsOptions = *options - pager = &VPNGatewayConnectionsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewayConnectionsPager) 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) { - 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) - 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.Connections - - 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) { - for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf - 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 *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 *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, 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 -} - -// 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 -} diff --git a/go.mod b/go.mod index 73c99ef76e..c68af0c2bb 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/IBM/secrets-manager-go-sdk/v2 v2.0.15 github.com/IBM/vmware-go-sdk v0.1.5 github.com/IBM/vpc-beta-go-sdk v0.8.0 - github.com/IBM/vpc-go-sdk v0.70.1 + github.com/IBM/vpc-go-sdk v0.72.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 @@ -236,8 +236,6 @@ replace github.com/hashicorp/consul/api v1.1.0 => github.com/hashicorp/consul/ap replace github.com/hashicorp/vault => github.com/hashicorp/vault v1.18.2 -replace github.com/IBM/vpc-go-sdk => ./common/github.com/IBM/vpc-go-sdk - replace github.com/hashicorp/vault/api/auth/approle => github.com/hashicorp/vault/api/auth/approle v0.8.0 exclude ( diff --git a/go.sum b/go.sum index c4c1de21f1..07a17c9dfc 100644 --- a/go.sum +++ b/go.sum @@ -169,8 +169,8 @@ github.com/IBM/vmware-go-sdk v0.1.5 h1:aQbwcJBceaaauuIoJ0OJn+ttwjb+QTX6XV9Jbrdpj github.com/IBM/vmware-go-sdk v0.1.5/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo= 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.70.1 h1:6NsbRkiA5gDNxe7cjNx8Pi1j9s0PlhwNQj29wsKZxAo= -github.com/IBM/vpc-go-sdk v0.70.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA= +github.com/IBM/vpc-go-sdk v0.72.0 h1:3Pj7nNuYmlaRPiMyC/5Uro3+5hzNBM6v2Lrq5UABBkQ= +github.com/IBM/vpc-go-sdk v0.72.0/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA= 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/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= diff --git a/ibm/service/vpc/data_source_ibm_is_share.go b/ibm/service/vpc/data_source_ibm_is_share.go index 3ebe04982d..646a7025d7 100644 --- a/ibm/service/vpc/data_source_ibm_is_share.go +++ b/ibm/service/vpc/data_source_ibm_is_share.go @@ -35,6 +35,11 @@ func DataSourceIbmIsShare() *schema.Resource { ExactlyOneOf: []string{"share", "name"}, Description: "Name of the share.", }, + "availability_mode": { + Type: schema.TypeString, + Computed: true, + Description: "Availability mode of the share.", + }, "allowed_transit_encryption_modes": { Type: schema.TypeList, Computed: true, @@ -601,6 +606,11 @@ func DataSourceIbmIsShare() *schema.Resource { }, }, }, + "storage_generation": { + Type: schema.TypeInt, + Computed: true, + Description: "The storage generation for this share", + }, }, } } @@ -710,6 +720,11 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m if share.AccessControlMode != nil { d.Set("access_control_mode", *share.AccessControlMode) } + if share.AvailabilityMode != nil { + if err = d.Set("availability_mode", *share.AvailabilityMode); err != nil { + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-availability_mode").GetDiag() + } + } if !core.IsNil(share.AllowedTransitEncryptionModes) { if err = d.Set("allowed_transit_encryption_modes", share.AllowedTransitEncryptionModes); err != nil { err = fmt.Errorf("Error setting allowed_transit_encryption_modes: %s", err) @@ -842,6 +857,10 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m if err = d.Set("source_snapshot", sourceSnapshot); err != nil { return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting source_snapshot: %s", err), "(Data) ibm_is_share", "read", "set-source_snapshot").GetDiag() } + + if err := d.Set("storage_generation", flex.IntValue(share.StorageGeneration)); err != nil { + return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting storage_generation: %s", err), "(Data) ibm_is_share", "read", "set-storage_generation").GetDiag() + } accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *share.CRN, "", isAccessTagType) if err != nil { tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting shares (%s) access tags: %s", d.Id(), err), "(Data) ibm_is_share", "read") 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 500d917cd7..570e20ce40 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_profile.go +++ b/ibm/service/vpc/data_source_ibm_is_share_profile.go @@ -26,6 +26,139 @@ func DataSourceIbmIsShareProfile() *schema.Resource { Required: true, Description: "The file share profile name.", }, + "allowed_access_protocols": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The default allowed access protocol modes for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "values": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The possible allowed access protocols for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "allowed_transit_encryption_modes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The default allowed transit encryption modes for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "values": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The allowed transit encryption modes for a share with this profile", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "availability_modes": { + Type: schema.TypeList, + Computed: true, + Description: "The data availability mode of a share with this profile..", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": { + Type: schema.TypeString, + Computed: true, + Description: "The default data availability mode for this profile.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "The value for this profile field", + }, + "values": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The permitted values for this profile field.", + }, + }, + }, + }, + "bandwidth": { + Type: schema.TypeList, + Computed: true, + Description: "The permitted capacity range (in gigabytes) for a share with this profile.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": { + Type: schema.TypeInt, + Computed: true, + Description: "The default capacity.", + }, + "max": { + Type: schema.TypeInt, + Computed: true, + Description: "The max capacity.", + }, + "min": { + Type: schema.TypeInt, + Computed: true, + Description: "The min capacity.", + }, + "step": { + Type: schema.TypeInt, + Computed: true, + Description: "The increment step value for this profile field.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "value": { + Type: schema.TypeInt, + Computed: true, + Description: "The value for this profile field", + }, + "values": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeInt}, + Description: "The permitted values for this profile field.", + }, + }, + }, + }, "capacity": { Type: schema.TypeList, Computed: true, @@ -152,7 +285,46 @@ func dataSourceIbmIsShareProfileRead(context context.Context, d *schema.Resource log.Printf("[DEBUG] %s", tfErr.GetDebugMessage()) return tfErr.GetDiag() } - + if shareProfile.AllowedAccessProtocols != nil { + allowedAccessprotocolsList := []map[string]interface{}{} + allowedAccessprotocols := shareProfile.AllowedAccessProtocols.(*vpcv1.ShareProfileAllowedAccessProtocols) + allowedAccessprotocolsMap := dataSourceShareProfileAllowedAccessProtocolToMap(*allowedAccessprotocols) + allowedAccessprotocolsList = append(allowedAccessprotocolsList, allowedAccessprotocolsMap) + if err = d.Set("allowed_access_protocols", allowedAccessprotocolsList); err != nil { + err = fmt.Errorf("Error setting allowed_access_protocols: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_profile", "read", "set-allowed_access_protocols").GetDiag() + } + } + if shareProfile.AllowedTransitEncryptionModes != nil { + allowedTEMList := []map[string]interface{}{} + allowedTEM := shareProfile.AllowedTransitEncryptionModes.(*vpcv1.ShareProfileAllowedTransitEncryptionModes) + allowedTEMMap := dataSourceShareProfileAllowedTransitEncryptionToMap(*allowedTEM) + allowedTEMList = append(allowedTEMList, allowedTEMMap) + if err = d.Set("allowed_transit_encryption_modes", allowedTEMList); err != nil { + err = fmt.Errorf("Error setting allowed_transit_encryption_modes: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_profile", "read", "set-allowed_transit_encryption_modes").GetDiag() + } + } + if shareProfile.AvailabilityModes != nil { + availabilityModesList := []map[string]interface{}{} + availabilityModes := shareProfile.AvailabilityModes.(*vpcv1.ShareProfileAvailabilityModes) + availabilityModesMap := dataSourceShareProfileAvailabilityModesToMap(*availabilityModes) + availabilityModesList = append(availabilityModesList, availabilityModesMap) + if err = d.Set("availability_modes", availabilityModesList); err != nil { + err = fmt.Errorf("Error setting availability_modes: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_profile", "read", "set-availability_modes").GetDiag() + } + } + if shareProfile.Bandwidth != nil { + bandwidthList := []map[string]interface{}{} + bandwidth := shareProfile.Bandwidth.(*vpcv1.ShareProfileBandwidth) + bandwidthMap := dataSourceShareProfileBandwidthToMap(*bandwidth) + bandwidthList = append(bandwidthList, bandwidthMap) + if err = d.Set("bandwidth", bandwidthList); err != nil { + err = fmt.Errorf("Error setting bandwidth: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_profile", "read", "set-bandwidth").GetDiag() + } + } if shareProfile.Capacity != nil { capacityList := []map[string]interface{}{} capacity := shareProfile.Capacity.(*vpcv1.ShareProfileCapacity) @@ -215,10 +387,18 @@ func dataSourceShareProfileCapacityToMap(capacity vpcv1.ShareProfileCapacity) (c // if capacity.Default != nil { // capacityMap["default"] = int(*capacity.Default) // } - capacityMap["max"] = capacity.Max - capacityMap["min"] = capacity.Min - capacityMap["step"] = capacity.Step - capacityMap["type"] = capacity.Type + if capacity.Max != nil { + capacityMap["max"] = capacity.Max + } + if capacity.Min != nil { + capacityMap["min"] = capacity.Min + } + if capacity.Step != nil { + capacityMap["step"] = capacity.Step + } + if capacity.Type != nil { + capacityMap["type"] = capacity.Type + } if capacity.Value != nil { capacityMap["value"] = int(*capacity.Value) } @@ -231,6 +411,99 @@ func dataSourceShareProfileCapacityToMap(capacity vpcv1.ShareProfileCapacity) (c } return capacityMap } +func dataSourceShareProfileBandwidthToMap(bandwidth vpcv1.ShareProfileBandwidth) (bandwidthMap map[string]interface{}) { + bandwidthMap = map[string]interface{}{} + if bandwidth.Default != nil { + bandwidthMap["default"] = int(*bandwidth.Default) + } + + if bandwidth.Max != nil { + bandwidthMap["max"] = *bandwidth.Max + } + if bandwidth.Min != nil { + bandwidthMap["min"] = *bandwidth.Min + } + if bandwidth.Step != nil { + bandwidthMap["step"] = *bandwidth.Step + } + if bandwidth.Type != nil { + bandwidthMap["type"] = *bandwidth.Type + } + + if bandwidth.Value != nil { + bandwidthMap["value"] = bandwidth.Value + } + if bandwidth.Values != nil { + bandwidthMap["values"] = bandwidth.Values + } + return bandwidthMap +} +func dataSourceShareProfileAllowedAccessProtocolToMap(allowedAccessProtocol vpcv1.ShareProfileAllowedAccessProtocols) (allowedAccessProtocolMap map[string]interface{}) { + allowedAccessProtocolMap = map[string]interface{}{} + + if allowedAccessProtocol.Type != nil { + allowedAccessProtocolMap["type"] = allowedAccessProtocol.Type + } + defaults := []string{} + if len(allowedAccessProtocol.Default) > 0 { + for _, value := range allowedAccessProtocol.Default { + defaults = append(defaults, value) + } + allowedAccessProtocolMap["default"] = defaults + } + values := []string{} + if len(allowedAccessProtocol.Values) > 0 { + for _, value := range allowedAccessProtocol.Values { + values = append(values, value) + } + allowedAccessProtocolMap["values"] = values + } + return allowedAccessProtocolMap +} + +func dataSourceShareProfileAllowedTransitEncryptionToMap(transitEncryptionModes vpcv1.ShareProfileAllowedTransitEncryptionModes) (transitEncryptionModesMap map[string]interface{}) { + transitEncryptionModesMap = map[string]interface{}{} + + if transitEncryptionModes.Type != nil { + transitEncryptionModesMap["type"] = transitEncryptionModes.Type + } + defaults := []string{} + if len(transitEncryptionModes.Default) > 0 { + for _, value := range transitEncryptionModes.Default { + defaults = append(defaults, value) + } + transitEncryptionModesMap["default"] = defaults + } + values := []string{} + if len(transitEncryptionModes.Values) > 0 { + for _, value := range transitEncryptionModes.Values { + values = append(values, value) + } + transitEncryptionModesMap["values"] = values + } + return transitEncryptionModesMap +} +func dataSourceShareProfileAvailabilityModesToMap(availabilityModes vpcv1.ShareProfileAvailabilityModes) (availabilityModesMap map[string]interface{}) { + availabilityModesMap = map[string]interface{}{} + + if availabilityModes.Type != nil { + availabilityModesMap["type"] = availabilityModes.Type + } + if availabilityModes.Default != nil { + availabilityModesMap["default"] = availabilityModes.Default + } + if availabilityModes.Value != nil { + availabilityModesMap["value"] = availabilityModes.Value + } + values := []string{} + if len(availabilityModes.Values) > 0 { + for _, value := range availabilityModes.Values { + values = append(values, value) + } + availabilityModesMap["values"] = values + } + return availabilityModesMap +} // dataSourceIbmIsShareProfileID returns a reasonable ID for the list. func dataSourceIbmIsShareProfileID(d *schema.ResourceData) string { diff --git a/ibm/service/vpc/data_source_ibm_is_share_profiles.go b/ibm/service/vpc/data_source_ibm_is_share_profiles.go index ee7c3f5cfb..5c27970353 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_profiles.go +++ b/ibm/service/vpc/data_source_ibm_is_share_profiles.go @@ -27,6 +27,139 @@ func DataSourceIbmIsShareProfiles() *schema.Resource { Description: "Collection of share profiles.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "allowed_access_protocols": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The default allowed access protocol modes for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "values": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The possible allowed access protocols for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "allowed_transit_encryption_modes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The default allowed transit encryption modes for shares with this profile.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "values": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The allowed transit encryption modes for a share with this profile", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "availability_modes": { + Type: schema.TypeList, + Computed: true, + Description: "The data availability mode of a share with this profile..", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": { + Type: schema.TypeString, + Computed: true, + Description: "The default data availability mode for this profile.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "The value for this profile field", + }, + "values": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The permitted values for this profile field.", + }, + }, + }, + }, + "bandwidth": { + Type: schema.TypeList, + Computed: true, + Description: "The permitted bandwidth (in megabits per second) for a share with this profile", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default": { + Type: schema.TypeInt, + Computed: true, + Description: "The default capacity.", + }, + "max": { + Type: schema.TypeInt, + Computed: true, + Description: "The max capacity.", + }, + "min": { + Type: schema.TypeInt, + Computed: true, + Description: "The min capacity.", + }, + "step": { + Type: schema.TypeInt, + Computed: true, + Description: "The increment step value for this profile field.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The type for this profile field.", + }, + "value": { + Type: schema.TypeInt, + Computed: true, + Description: "The value for this profile field", + }, + "values": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeInt}, + Description: "The permitted values for this profile field.", + }, + }, + }, + }, "capacity": { Type: schema.TypeList, Computed: true, @@ -211,6 +344,36 @@ func dataSourceShareProfileCollectionProfilesToMap(profilesItem vpcv1.ShareProfi if profilesItem.ResourceType != nil { profilesMap["resource_type"] = profilesItem.ResourceType } + + if profilesItem.AllowedAccessProtocols != nil { + allowedAccessprotocolsList := []map[string]interface{}{} + allowedAccessprotocols := profilesItem.AllowedAccessProtocols.(*vpcv1.ShareProfileAllowedAccessProtocols) + allowedAccessprotocolsMap := dataSourceShareProfileAllowedAccessProtocolToMap(*allowedAccessprotocols) + allowedAccessprotocolsList = append(allowedAccessprotocolsList, allowedAccessprotocolsMap) + profilesMap["allowed_access_protocols"] = allowedAccessprotocolsList + } + if profilesItem.AllowedTransitEncryptionModes != nil { + allowedTEMList := []map[string]interface{}{} + allowedTEM := profilesItem.AllowedTransitEncryptionModes.(*vpcv1.ShareProfileAllowedTransitEncryptionModes) + allowedTEMMap := dataSourceShareProfileAllowedTransitEncryptionToMap(*allowedTEM) + allowedTEMList = append(allowedTEMList, allowedTEMMap) + profilesMap["allowed_transit_encryption_modes"] = allowedTEMList + } + if profilesItem.AvailabilityModes != nil { + availabilityModesList := []map[string]interface{}{} + availabilityModes := profilesItem.AvailabilityModes.(*vpcv1.ShareProfileAvailabilityModes) + availabilityModesMap := dataSourceShareProfileAvailabilityModesToMap(*availabilityModes) + availabilityModesList = append(availabilityModesList, availabilityModesMap) + profilesMap["availability_modes"] = availabilityModesList + } + if profilesItem.Bandwidth != nil { + bandwidthList := []map[string]interface{}{} + bandwidth := profilesItem.Bandwidth.(*vpcv1.ShareProfileBandwidth) + bandwidthMap := dataSourceShareProfileBandwidthToMap(*bandwidth) + bandwidthList = append(bandwidthList, bandwidthMap) + profilesMap["bandwidth"] = bandwidthList + } + if profilesItem.Capacity != nil { capacityList := []map[string]interface{}{} capacity := profilesItem.Capacity.(*vpcv1.ShareProfileCapacity) diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshot.go b/ibm/service/vpc/data_source_ibm_is_share_snapshot.go index 47867f3368..48d513032e 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshot.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshot.go @@ -428,7 +428,7 @@ func DataSourceIBMIsShareSnapshotShareSnapshotStatusReasonToMap(model *vpcv1.Sha return modelMap, nil } -func DataSourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { +func DataSourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go b/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go index 9a6bfda4cd..94e1c41b0a 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshot_test.go @@ -270,7 +270,7 @@ func TestDataSourceIBMIsShareSnapshotZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ShareSnapshotZone) + model := new(vpcv1.ZoneReference) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshots.go b/ibm/service/vpc/data_source_ibm_is_share_snapshots.go index e3c5721c2d..1e6d6e3f28 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshots.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshots.go @@ -366,12 +366,13 @@ func DataSourceIBMIsShareSnapshotsShareSnapshotToMap(model *vpcv1.ShareSnapshot) if model.UserTags != nil { modelMap["user_tags"] = model.UserTags } - zoneMap, err := DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model.Zone) - if err != nil { - return modelMap, err + if model.Zone != nil { + zoneMap, err := DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model.Zone) + if err != nil { + return modelMap, err + } + modelMap["zone"] = []map[string]interface{}{zoneMap} } - modelMap["zone"] = []map[string]interface{}{zoneMap} - if model.UserTags != nil { modelMap["tags"] = model.UserTags } @@ -445,7 +446,7 @@ func DataSourceIBMIsShareSnapshotsShareSnapshotStatusReasonToMap(model *vpcv1.Sh return modelMap, nil } -func DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { +func DataSourceIBMIsShareSnapshotsZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name diff --git a/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go b/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go index 8904406a49..766463f131 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_snapshots_test.go @@ -189,7 +189,7 @@ func TestDataSourceIBMIsShareSnapshotsShareSnapshotToMap(t *testing.T) { shareSnapshotStatusReasonModel.Message = core.StringPtr("testString") shareSnapshotStatusReasonModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys") - zoneReferenceModel := new(vpcv1.ShareSnapshotZone) + zoneReferenceModel := new(vpcv1.ZoneReference) zoneReferenceModel.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") zoneReferenceModel.Name = core.StringPtr("us-south-1") @@ -369,7 +369,7 @@ func TestDataSourceIBMIsShareSnapshotsZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ShareSnapshotZone) + model := new(vpcv1.ZoneReference) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") diff --git a/ibm/service/vpc/data_source_ibm_is_share_test.go b/ibm/service/vpc/data_source_ibm_is_share_test.go index afdcf8a495..dc9b36beab 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_test.go @@ -31,6 +31,7 @@ func TestAccIbmIsShareDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "lifecycle_state"), resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "name"), resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "profile"), + resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "storage_generation"), resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "resource_group"), resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "resource_type"), resource.TestCheckResourceAttrSet("data.ibm_is_share.is_share", "size"), diff --git a/ibm/service/vpc/data_source_ibm_is_shares.go b/ibm/service/vpc/data_source_ibm_is_shares.go index 667e815dab..deb2ad415b 100644 --- a/ibm/service/vpc/data_source_ibm_is_shares.go +++ b/ibm/service/vpc/data_source_ibm_is_shares.go @@ -45,6 +45,11 @@ func DataSourceIbmIsShares() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Allowed transit encryption modes", }, + "availability_mode": { + Type: schema.TypeString, + Computed: true, + Description: "Availability mode of the share.", + }, "access_control_mode": { Type: schema.TypeString, Computed: true, @@ -572,6 +577,11 @@ func DataSourceIbmIsShares() *schema.Resource { }, }, }, + "storage_generation": { + Type: schema.TypeInt, + Computed: true, + Description: "The storage generation for this share", + }, }, }, }, @@ -726,6 +736,9 @@ func dataSourceShareCollectionSharesToMap(meta interface{}, sharesItem vpcv1.Sha if !core.IsNil(sharesItem.AllowedTransitEncryptionModes) { sharesMap["allowed_transit_encryption_modes"] = sharesItem.AllowedTransitEncryptionModes } + if sharesItem.AvailabilityMode != nil { + sharesMap["availability_mode"] = *sharesItem.AvailabilityMode + } if !core.IsNil(sharesItem.AllowedAccessProtocols) { sharesMap["allowed_access_protocols"] = sharesItem.AllowedAccessProtocols } @@ -790,6 +803,9 @@ func dataSourceShareCollectionSharesToMap(meta interface{}, sharesItem vpcv1.Sha sourceSnapshot = append(sourceSnapshot, modelMap) } sharesMap["source_snapshot"] = sourceSnapshot + + sharesMap["storage_generation"] = flex.IntValue(sharesItem.StorageGeneration) + accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *sharesItem.CRN, "", isAccessTagType) if err != nil { log.Printf( diff --git a/ibm/service/vpc/data_source_ibm_is_shares_test.go b/ibm/service/vpc/data_source_ibm_is_shares_test.go index 34fd6f9c78..0d86136401 100644 --- a/ibm/service/vpc/data_source_ibm_is_shares_test.go +++ b/ibm/service/vpc/data_source_ibm_is_shares_test.go @@ -52,6 +52,7 @@ func TestAccIbmIsSharesDataSourceAllArgs(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "shares.0.name"), resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "shares.0.resource_type"), resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "shares.0.size"), + resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "shares.0.storage_generation"), resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "shares.0.accessor_binding_role"), resource.TestCheckResourceAttrSet("data.ibm_is_shares.is_shares", "total_count"), ), diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 5ad0806703..b107e45b8b 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -65,14 +65,20 @@ func ResourceIbmIsShare() *schema.Resource { Optional: true, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, - ConflictsWith: []string{"replica_share", "origin_share"}, + ConflictsWith: []string{"replica_share", "origin_share", "source_share"}, Description: "The access protocols to allow for this share", }, - "bandwidth": { - Type: schema.TypeInt, - Optional: true, + "availability_mode": { + Type: schema.TypeString, Computed: true, - Description: "The bandwidth for the file share.", + Description: "Availability mode of the share.", + }, + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ConflictsWith: []string{"replica_share", "origin_share", "source_share"}, + Description: "The bandwidth for the file share.", }, "encryption_key": { Type: schema.TypeString, @@ -137,6 +143,12 @@ func ResourceIbmIsShare() *schema.Resource { Description: "The share targets for this file share.Share targets mounted from a replica must be mounted read-only.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "access_protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The protocol to use to access the share for this share mount target.", + }, "id": { Type: schema.TypeString, Computed: true, @@ -322,6 +334,13 @@ func ResourceIbmIsShare() *schema.Resource { Description: "Configuration for a replica file share to create and associate with this file share. Ifunspecified, a replica may be subsequently added by creating a new file share with a`source_share` referencing this file share.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "allowed_transit_encryption_modes": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Allowed transit encryption modes", + }, "crn": { Type: schema.TypeString, Computed: true, @@ -401,6 +420,12 @@ func ResourceIbmIsShare() *schema.Resource { Description: "The share targets for this replica file share.Share targets mounted from a replica must be mounted read-only.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "access_protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The protocol to use to access the share for this share mount target.", + }, "href": { Type: schema.TypeString, Computed: true, @@ -578,8 +603,8 @@ func ResourceIbmIsShare() *schema.Resource { }, "zone": { Type: schema.TypeString, - Required: true, - ForceNew: true, + Optional: true, + Computed: true, Description: "The name of the zone this replica file share will reside in. Must be a different zone in the same region as the source share.", }, }, @@ -919,7 +944,6 @@ func ResourceIbmIsShare() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ForceNew: true, Description: "The globally unique name of the zone this file share will reside in.", }, isFileShareTags: { @@ -992,6 +1016,11 @@ func ResourceIbmIsShare() *schema.Resource { }, }, }, + "storage_generation": { + Type: schema.TypeInt, + Computed: true, + Description: "The storage generation for this share", + }, }, } } @@ -1079,9 +1108,6 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m allowedAccessProtocolsList = append(allowedAccessProtocolsList, allowedAccessProtocolsIntf.(string)) } sharePrototype.AllowedAccessProtocols = allowedAccessProtocolsList - } else { - allowedAccessProtocols := []string{"nfs4"} - sharePrototype.AllowedAccessProtocols = allowedAccessProtocols } if bandwidthIntf, bandwidthOk := d.GetOk("bandwidth"); bandwidthOk { bandwidth := int64(bandwidthIntf.(int)) @@ -1143,6 +1169,20 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m if replicaShareIntf, ok := d.GetOk("replica_share"); ok { replicaShareMap := replicaShareIntf.([]interface{})[0].(map[string]interface{}) replicaShare := &vpcv1.SharePrototypeShareContext{} + + if allowedTEMIntf, ok := replicaShareMap["allowed_transit_encryption_modes"]; ok { + allowedTransitEncryptionModes := []string{} + allowedTransitEncryptionModesIntf := allowedTEMIntf.([]interface{}) + for _, allowedTransitEncryptionModesItemIntf := range allowedTransitEncryptionModesIntf { + allowedTransitEncryptionModesItem := allowedTransitEncryptionModesItemIntf.(string) + if allowedTransitEncryptionModesItem == "user_managed" { + allowedTransitEncryptionModesItem = "ipsec" + } + allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) + } + replicaShare.AllowedTransitEncryptionModes = allowedTransitEncryptionModes + } + iopsIntf, ok := replicaShareMap["iops"] iops := iopsIntf.(int) if ok && iops != 0 { @@ -1359,10 +1399,28 @@ func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, sh } } + if accessProtocolIntf, ok := shareTargetPrototypeMap["access_protocol"]; ok && accessProtocolIntf != nil { + accessProtocol := accessProtocolIntf.(string) + shareTargetPrototype.AccessProtocol = &accessProtocol + } else { + accessProtocol := "nfs4" + shareTargetPrototype.AccessProtocol = &accessProtocol + } if transitEncryptionIntf, ok := shareTargetPrototypeMap["transit_encryption"]; ok && transitEncryptionIntf != "" { transitEncryption := transitEncryptionIntf.(string) + if transitEncryption == "user_managed" { + transitEncryption = "ipsec" + } shareTargetPrototype.TransitEncryption = &transitEncryption + } else { + shareProfile := d.Get("profile").(string) + if shareProfile == "dp2" { + shareTargetPrototype.TransitEncryption = &[]string{"ipsec"}[0] + } else if shareProfile == "rfs" { + shareTargetPrototype.TransitEncryption = &[]string{"stunnel"}[0] + } } + return shareTargetPrototype, nil } @@ -1388,7 +1446,11 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage()) return tfErr.GetDiag() } - + if share.AvailabilityMode != nil { + if err = d.Set("availability_mode", *share.AvailabilityMode); err != nil { + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-availability_mode").GetDiag() + } + } if share.EncryptionKey != nil { if err = d.Set("encryption_key", *share.EncryptionKey.CRN); err != nil { return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-encryption_key").GetDiag() @@ -1514,7 +1576,7 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met } } - if share.Zone != nil { + if share.Zone != nil && share.Zone.Name != nil && *share.Zone.Name != "" { if err = d.Set("zone", *share.Zone.Name); err != nil { return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-zone").GetDiag() } @@ -1607,7 +1669,9 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met status_reasons = append(status_reasons, status_reason) } d.Set("replication_status_reasons", status_reasons) - + if err := d.Set("storage_generation", flex.IntValue(share.StorageGeneration)); err != nil { + return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting storage_generation: %s", err), "ibm_is_share", "read", "set-storage_generation").GetDiag() + } accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *share.CRN, "", isAccessTagType) if err != nil { log.Printf( @@ -1923,7 +1987,10 @@ func ShareReplicaToMap(context context.Context, vpcClient *vpcv1.VpcV1, d *schem shareReplicaMap["replication_role"] = shareReplica.ReplicationRole shareReplicaMap["profile"] = shareReplica.Profile.Name shareReplicaMap["replication_status"] = shareReplica.ReplicationStatus - shareReplicaMap["zone"] = shareReplica.Zone.Name + + if shareReplica.Zone != nil && shareReplica.Zone.Name != nil && *shareReplica.Zone.Name != "" { + shareReplicaMap["zone"] = shareReplica.Zone.Name + } status_reasons := []map[string]interface{}{} for _, status_reason_item := range shareReplica.ReplicationStatusReasons { status_reason := make(map[string]interface{}) @@ -2066,11 +2133,23 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso var allowedTransitEncryptionModes []string for _, v := range d.Get("allowed_transit_encryption_modes").([]interface{}) { allowedTransitEncryptionModesItem := v.(string) + if allowedTransitEncryptionModesItem == "user_managed" { + allowedTransitEncryptionModesItem = "ipsec" + } allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) } sharePatchModel.AllowedTransitEncryptionModes = allowedTransitEncryptionModes hasChange = true } + if d.HasChange("access_control_protocols") { + var access_control_protocols []string + for _, v := range d.Get("access_control_protocols").([]interface{}) { + allowedTransitEncryptionModesItem := v.(string) + access_control_protocols = append(access_control_protocols, allowedTransitEncryptionModesItem) + } + sharePatchModel.AllowedAccessProtocols = access_control_protocols + hasChange = true + } } if d.HasChange(replicationCronSpec) { replicationCronSpecStr := d.Get(replicationCronSpec).(string) diff --git a/ibm/service/vpc/resource_ibm_is_share_mount_target.go b/ibm/service/vpc/resource_ibm_is_share_mount_target.go index 4d4cb49e3a..226812b9a2 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -39,7 +39,6 @@ func ResourceIBMIsShareMountTarget() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - Default: "nfs4", Description: "The protocol to use to access the share for this share mount target.", }, "name": { @@ -363,6 +362,9 @@ func resourceIBMIsShareMountTargetCreate(context context.Context, d *schema.Reso if accessProtocolIntf, ok := d.GetOk("access_protocol"); ok { accessProtocol := accessProtocolIntf.(string) shareMountTargetPrototype.AccessProtocol = &accessProtocol + } else { + accessProtocol := "nfs4" + shareMountTargetPrototype.AccessProtocol = &accessProtocol } if transitEncryptionIntf, ok := d.GetOk("transit_encryption"); ok { transitEncryption := transitEncryptionIntf.(string) diff --git a/ibm/service/vpc/resource_ibm_is_share_snapshot.go b/ibm/service/vpc/resource_ibm_is_share_snapshot.go index 87570c2a17..1af1919509 100644 --- a/ibm/service/vpc/resource_ibm_is_share_snapshot.go +++ b/ibm/service/vpc/resource_ibm_is_share_snapshot.go @@ -484,9 +484,12 @@ func resourceIBMIsShareSnapshotRead(context context.Context, d *schema.ResourceD err = fmt.Errorf("Error setting status_reasons: %s", err) return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share_snapshot", "read", "set-status_reasons").GetDiag() } - zoneMap, err := ResourceIBMIsShareSnapshotZoneReferenceToMap(shareSnapshot.Zone) - if err != nil { - return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share_snapshot", "read", "zone-to-map").GetDiag() + zoneMap := make(map[string]interface{}) + if shareSnapshot.Zone != nil { + zoneMap, err = ResourceIBMIsShareSnapshotZoneReferenceToMap(shareSnapshot.Zone) + if err != nil { + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share_snapshot", "read", "zone-to-map").GetDiag() + } } if err = d.Set("zone", []map[string]interface{}{zoneMap}); err != nil { err = fmt.Errorf("Error setting zone: %s", err) @@ -691,7 +694,7 @@ func ResourceIBMIsShareSnapshotShareSnapshotStatusReasonToMap(model *vpcv1.Share return modelMap, nil } -func ResourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ShareSnapshotZone) (map[string]interface{}, error) { +func ResourceIBMIsShareSnapshotZoneReferenceToMap(model *vpcv1.ZoneReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = *model.Href modelMap["name"] = *model.Name diff --git a/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go b/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go index a55c15bb62..f297a84024 100644 --- a/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_snapshot_test.go @@ -313,7 +313,7 @@ func TestResourceIBMIsShareSnapshotZoneReferenceToMap(t *testing.T) { assert.Equal(t, result, model) } - model := new(vpcv1.ShareSnapshotZone) + model := new(vpcv1.ZoneReference) model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1") model.Name = core.StringPtr("us-south-1") diff --git a/ibm/service/vpc/resource_ibm_is_share_test.go b/ibm/service/vpc/resource_ibm_is_share_test.go index a8942ce259..94b0e0b887 100644 --- a/ibm/service/vpc/resource_ibm_is_share_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_test.go @@ -344,7 +344,37 @@ func TestAccIbmIsShareOriginShare(t *testing.T) { }, }) } +func TestAccIbmIsShareRegionalShare(t *testing.T) { + var conf vpcv1.Share + // name := fmt.Sprintf("tf-fs-name-%d", acctest.RandIntRange(10, 100)) + subnetName := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) + shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100)) + + tEMode1 := "stunnel" + allowedAccessProtocol := "nfs4" + + // tEMode2 := "none" + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIbmIsShareDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIbmIsShareConfigRegionalShareConfig(vpcname, subnetName, tEMode1, shareName, allowedAccessProtocol), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckIbmIsShareExists("ibm_is_share.is_share", conf), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "name", shareName), + resource.TestCheckResourceAttrSet("ibm_is_share.is_share", "id"), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "allowed_transit_encryption_modes.0", tEMode1), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "allowed_access_protocols.0", allowedAccessProtocol), + resource.TestCheckResourceAttr("ibm_is_share.is_share", "bandwidth", "100"), + ), + }, + }, + }) +} func TestAccIbmIsShareFromShareSnapshot(t *testing.T) { var conf vpcv1.Share @@ -492,6 +522,20 @@ func testAccCheckIbmIsShareConfigOriginShareConfig(vpcName, sname, tEMode, share `, vpcName, sname, acc.ISCIDR, tEMode, shareName, shareName1) } +func testAccCheckIbmIsShareConfigRegionalShareConfig(vpcName, sname, tEMode, shareName, allowedAccessProtocol string) string { + return fmt.Sprintf(` + + resource "ibm_is_share" "is_share" { + allowed_transit_encryption_modes = ["%s"] + allowed_access_protocols = ["%s"] + size = 220 + name = "%s" + profile = "rfs" + bandwidth = 100 + } + `, tEMode, allowedAccessProtocol, shareName) +} + func testAccCheckIbmIsShareConfigShareSnapshotConfig(vpcName, sname, tEMode, shareName, shareSnapName, shareName1 string) string { return fmt.Sprintf(` diff --git a/website/docs/d/is_share.html.markdown b/website/docs/d/is_share.html.markdown index 4ef29f9adf..95c4b0ed83 100644 --- a/website/docs/d/is_share.html.markdown +++ b/website/docs/d/is_share.html.markdown @@ -46,6 +46,10 @@ The following attributes are exported: - `access_control_mode` - (Boolean) The access control mode for the share. - `accessor_binding_role` - (String) 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). +- `allowed_transit_encryption_modes` - (List of string) The transit encryption modes to allow for this share. +- `availability_mode` - (String) The data availability mode of the share +- `allowed_access_protocols` - (String) The access protocols to allow for this share +- `bandwidth` - (Integer) The maximum bandwidth (in megabits per second) for the share. - `accessor_bindings` - (List) 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. Nested schema for **accessor_bindings**: - `href` - (String) The URL for this share accessor binding. diff --git a/website/docs/d/is_share_profile.html.markdown b/website/docs/d/is_share_profile.html.markdown index af53870eb0..3c276a65f9 100644 --- a/website/docs/d/is_share_profile.html.markdown +++ b/website/docs/d/is_share_profile.html.markdown @@ -32,14 +32,35 @@ The following attributes are exported: - `family` - (String) The product family this share profile belongs to. - `href` - (String) The URL for this share profile. - `resource_type` - (String) The resource type. +- `allowed_access_protocols` - (List) The possible allowed access protocols for a share with this profile.. Nested `allowed_access_protocols` blocks have the following structure: + - `default` - (List of String) The default allowed access protocol modes for shares with this profile. + - `type` - (String) The type for this profile field + - `values` - (List of String) The possible allowed access protocols for shares with this profile. +- `allowed_transit_encryption_modes` - (List) The possible allowed transit encryption modes for a share with this profile.. Nested `allowed_transit_encryption_modes` blocks have the following structure: + - `default` - (List of String) The default allowed transit encryption modes for shares with this profile. + - `type` - (String) The type for this profile field. + - `values` - (List of String) The allowed transit encryption modes for a share with this profile. +- `availability_modes` - (List) The data availability mode of a share with this profile. Nested `availability_modes` blocks have the following structure: + - `default` - (List of String) The default allowed transit encryption modes for shares with this profile. + - `type` - (String) The type for this profile field. + - `value` - (String) The value for this profile field + - `values` - (List of String) The allowed transit encryption modes for a share with this profile. +- `bandwidth` - (List) The permitted bandwidth (in megabits per second) for a share with this profile. Nested `capacity` blocks have the following structure: + - `default` - (Integer) The default capacity for this share profile + - `max` - (Integer) The max capacity for this share profile + - `min` - (Integer) The min capacity for this share profile + - `step` - (Integer) The increment step value for this profile field + - `type` - (String) The type for this profile field + - `value` - (Integer) The value for this profile field + - `values` - (List of Integers) The permitted values for this profile field - `capacity` - (List) - The permitted capacity range (in gigabytes) for a share with this profile. Nested `capacity` blocks have the following structure: - - `default` - (Integer) The default capacity for this share profile - - `max` - (Integer) The max capacity for this share profile - - `min` - (Integer) The min capacity for this share profile - - `step` - (Integer) The increment step value for this profile field - - `type` - (String) The type for this profile field - - `value` - (Integer) The value for this profile field - - `values` - (List of Integers) The permitted values for this profile field + - `default` - (Integer) The default capacity for this share profile + - `max` - (Integer) The max capacity for this share profile + - `min` - (Integer) The min capacity for this share profile + - `step` - (Integer) The increment step value for this profile field + - `type` - (String) The type for this profile field + - `value` - (Integer) The value for this profile field + - `values` - (List of Integers) The permitted values for this profile field - `iops` - (List) - The permitted IOPS range for a share with this profile. Nested `iops` blocks have the following structure: - `default` - (Integer) The default iops for this share profile - `max` - (Integer) The max iops for this share profile diff --git a/website/docs/d/is_share_profiles.html.markdown b/website/docs/d/is_share_profiles.html.markdown index 92af5cf7a2..81a421dac8 100644 --- a/website/docs/d/is_share_profiles.html.markdown +++ b/website/docs/d/is_share_profiles.html.markdown @@ -26,6 +26,27 @@ The following attributes are exported: - `href` - (String) The URL for this share profile. - `name` - (String) The globally unique name for this share profile. - `resource_type` - (String) The resource type. + - `allowed_access_protocols` - (List) The possible allowed access protocols for a share with this profile.. Nested `allowed_access_protocols` blocks have the following structure: + - `default` - (List of String) The default allowed access protocol modes for shares with this profile. + - `type` - (String) The type for this profile field + - `values` - (List of String) The possible allowed access protocols for shares with this profile. + - `allowed_transit_encryption_modes` - (List) The possible allowed transit encryption modes for a share with this profile.. Nested `allowed_transit_encryption_modes` blocks have the following structure: + - `default` - (List of String) The default allowed transit encryption modes for shares with this profile. + - `type` - (String) The type for this profile field. + - `values` - (List of String) The allowed transit encryption modes for a share with this profile. + - `availability_modes` - (List) The data availability mode of a share with this profile. Nested `availability_modes` blocks have the following structure: + - `default` - (List of String) The default allowed transit encryption modes for shares with this profile. + - `type` - (String) The type for this profile field. + - `value` - (String) The value for this profile field + - `values` - (List of String) The allowed transit encryption modes for a share with this profile. + - `bandwidth` - (List) The permitted bandwidth (in megabits per second) for a share with this profile. Nested `capacity` blocks have the following structure: + - `default` - (Integer) The default capacity for this share profile + - `max` - (Integer) The max capacity for this share profile + - `min` - (Integer) The min capacity for this share profile + - `step` - (Integer) The increment step value for this profile field + - `type` - (String) The type for this profile field + - `value` - (Integer) The value for this profile field + - `values` - (List of Integers) The permitted values for this profile field - `capacity` - (List) The permitted capacity range (in gigabytes) for a share with this profile. Nested `capacity` blocks have the following structure: - `default` - (Integer) The default capacity for this share profile - `max` - (Integer) The max capacity for this share profile diff --git a/website/docs/d/is_shares.html.markdown b/website/docs/d/is_shares.html.markdown index 20c6d341bb..5a382e379a 100644 --- a/website/docs/d/is_shares.html.markdown +++ b/website/docs/d/is_shares.html.markdown @@ -29,6 +29,10 @@ The following arguments are supported: The following attributes are exported: - `shares` - Collection of file shares. Nested `shares` blocks have the following structure: + - `allowed_transit_encryption_modes` - (List of string) The transit encryption modes to allow for this share. + - `availability_mode` - (String) The data availability mode of the share + - `allowed_access_protocols` - (String) The access protocols to allow for this share + - `bandwidth` - (Integer) The maximum bandwidth (in megabits per second) for the share. - `access_control_mode` - (Boolean) The access control mode for the share. - `accessor_binding_role` - (String) 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). - `accessor_bindings` - (List) 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. From 0a5ea2ee844fb26e79ad82e0c29c1e473eadfac7 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Fri, 19 Sep 2025 00:05:58 +0530 Subject: [PATCH 10/13] update SA notes and diff suppress --- ...urce_ibm_is_share_accessor_binding_test.go | 2 +- ...rce_ibm_is_share_accessor_bindings_test.go | 2 +- ibm/service/vpc/resource_ibm_is_share.go | 76 ++++++++++++------- ...m_is_share_delete_accessor_binding_test.go | 2 +- website/docs/r/is_share.html.markdown | 14 +++- 5 files changed, 64 insertions(+), 32 deletions(-) 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 70ffb32cbf..c1baf76fe2 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 @@ -26,7 +26,7 @@ func TestAccIBMIsShareAccessorBindingDataSourceBasic(t *testing.T) { vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100)) shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100)) - tEMode1 := "user_managed" + tEMode1 := "ipsec" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, 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 6af1a6f07d..093012fe4e 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 @@ -27,7 +27,7 @@ func TestAccIBMIsShareAccessorBindingsDataSourceBasic(t *testing.T) { vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100)) shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100)) shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100)) - tEMode1 := "user_managed" + tEMode1 := "ipsec" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index b107e45b8b..32a6990a1a 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -31,6 +31,12 @@ const ( IsFileShareReplicationRoleReplica = "replica" ) +func normalizeValue(value string) string { + if value == "user_managed" { + return "ipsec" + } + return value +} func ResourceIbmIsShare() *schema.Resource { return &schema.Resource{ CreateContext: resourceIbmIsShareCreate, @@ -54,10 +60,26 @@ func ResourceIbmIsShare() *schema.Resource { Schema: map[string]*schema.Schema{ "allowed_transit_encryption_modes": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Set: func(v interface{}) int { + str := v.(string) + normalized := normalizeValue(str) + return schema.HashString(normalized) + }, + Elem: &schema.Schema{ + Type: schema.TypeString, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "user_managed" && new == "ipsec" { + return true + } + if old == "ipsec" && new == "user_managed" { + return true + } + return false + }, + }, Description: "Allowed transit encryption modes", }, "allowed_access_protocols": { @@ -164,6 +186,15 @@ func ResourceIbmIsShare() *schema.Resource { Optional: true, Computed: true, Description: "The transit encryption mode.", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "user_managed" && new == "ipsec" { + return true + } + if old == "ipsec" && new == "user_managed" { + return true + } + return false + }, }, "name": { Type: schema.TypeString, @@ -334,13 +365,6 @@ func ResourceIbmIsShare() *schema.Resource { Description: "Configuration for a replica file share to create and associate with this file share. Ifunspecified, a replica may be subsequently added by creating a new file share with a`source_share` referencing this file share.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "allowed_transit_encryption_modes": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Allowed transit encryption modes", - }, "crn": { Type: schema.TypeString, Computed: true, @@ -447,6 +471,15 @@ func ResourceIbmIsShare() *schema.Resource { Optional: true, Computed: true, Description: "The transit encryption mode.", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "user_managed" && new == "ipsec" { + return true + } + if old == "ipsec" && new == "user_managed" { + return true + } + return false + }, }, "virtual_network_interface": { Type: schema.TypeList, @@ -1170,19 +1203,6 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m replicaShareMap := replicaShareIntf.([]interface{})[0].(map[string]interface{}) replicaShare := &vpcv1.SharePrototypeShareContext{} - if allowedTEMIntf, ok := replicaShareMap["allowed_transit_encryption_modes"]; ok { - allowedTransitEncryptionModes := []string{} - allowedTransitEncryptionModesIntf := allowedTEMIntf.([]interface{}) - for _, allowedTransitEncryptionModesItemIntf := range allowedTransitEncryptionModesIntf { - allowedTransitEncryptionModesItem := allowedTransitEncryptionModesItemIntf.(string) - if allowedTransitEncryptionModesItem == "user_managed" { - allowedTransitEncryptionModesItem = "ipsec" - } - allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) - } - replicaShare.AllowedTransitEncryptionModes = allowedTransitEncryptionModes - } - iopsIntf, ok := replicaShareMap["iops"] iops := iopsIntf.(int) if ok && iops != 0 { @@ -1461,10 +1481,12 @@ func resourceIbmIsShareRead(context context.Context, d *schema.ResourceData, met return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-access_control_mode").GetDiag() } } + allowedaccessprotocols := []string{} if share.AllowedAccessProtocols != nil && len(share.AllowedAccessProtocols) > 0 { - if err = d.Set("allowed_access_protocols", *&share.AllowedAccessProtocols); err != nil { - return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag() - } + allowedaccessprotocols = share.AllowedAccessProtocols + } + if err = d.Set("allowed_access_protocols", allowedaccessprotocols); err != nil { + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag() } if err = d.Set("bandwidth", flex.IntValue(share.Bandwidth)); err != nil { return diag.FromErr(fmt.Errorf("Error setting bandwidth: %s", err)) diff --git a/ibm/service/vpc/resource_ibm_is_share_delete_accessor_binding_test.go b/ibm/service/vpc/resource_ibm_is_share_delete_accessor_binding_test.go index cc581c92df..9693843df0 100644 --- a/ibm/service/vpc/resource_ibm_is_share_delete_accessor_binding_test.go +++ b/ibm/service/vpc/resource_ibm_is_share_delete_accessor_binding_test.go @@ -22,7 +22,7 @@ func TestAccIbmIsShareDeleteAccessorBinding(t *testing.T) { shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100)) shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100)) shareName2 := fmt.Sprintf("tf-share2-%d", acctest.RandIntRange(10, 100)) - tEMode1 := "user_managed" + tEMode1 := "ipsec" // tEMode2 := "none" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, diff --git a/website/docs/r/is_share.html.markdown b/website/docs/r/is_share.html.markdown index 062ff6c043..d492ef45a8 100644 --- a/website/docs/r/is_share.html.markdown +++ b/website/docs/r/is_share.html.markdown @@ -11,7 +11,7 @@ subcategory: "VPC infrastructure" Provides a resource for Share. This allows Share to be created, updated and deleted. For more information, about share replication, see [Share replication](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). ~> **NOTE** - New shares should be created with profile `dp2`. Old Tiered profiles will be deprecated soon. + Regional file share `rfs` profile is available for accounts that have been granted special approval to preview the feature. ## Example Usage @@ -101,7 +101,7 @@ resource "ibm_is_share" "example-4" { ## Example share (Create accessor share for an origin share) ```terraform resource "ibm_is_share" "example-4" { - allowed_transit_encryption_modes = ["user_managed", "none"] + allowed_transit_encryption_modes = ["ipsec", "none"] access_control_mode = "security_group" name = "my-share" size = 200 @@ -121,6 +121,16 @@ resource "ibm_is_share" "example-6" { name = "my-replica1" } ``` +## Example share (Create a regional file share) +```terraform +resource "ibm_is_share" "example-4" { + allowed_transit_encryption_modes = ["stunnel", "none"] + access_control_mode = "security_group" + bandwidth = 210 + name = "my-share" + size = 200 + profile = " profile = "rfs" +} ## Argument Reference From 755a4dfa9a318872a46a94c4288573987d911443 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Fri, 19 Sep 2025 00:12:32 +0530 Subject: [PATCH 11/13] make transit encryption default to none, as per team suggestion --- ibm/service/vpc/resource_ibm_is_share.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 32a6990a1a..355463f4bd 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -1429,13 +1429,13 @@ func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, sh if transitEncryptionIntf, ok := shareTargetPrototypeMap["transit_encryption"]; ok && transitEncryptionIntf != "" { transitEncryption := transitEncryptionIntf.(string) if transitEncryption == "user_managed" { - transitEncryption = "ipsec" + transitEncryption = "none" } shareTargetPrototype.TransitEncryption = &transitEncryption } else { shareProfile := d.Get("profile").(string) if shareProfile == "dp2" { - shareTargetPrototype.TransitEncryption = &[]string{"ipsec"}[0] + shareTargetPrototype.TransitEncryption = &[]string{"none"}[0] } else if shareProfile == "rfs" { shareTargetPrototype.TransitEncryption = &[]string{"stunnel"}[0] } From 2ac164c338eb165f029aa111826808c12c765796 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Fri, 19 Sep 2025 12:04:27 +0530 Subject: [PATCH 12/13] Fix review comments --- ibm/service/vpc/data_source_ibm_is_share_mount_target.go | 5 +++-- website/docs/d/is_share.html.markdown | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) 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 478a3c2aa2..867e0f219c 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 @@ -374,8 +374,9 @@ func dataSourceIBMIsShareTargetRead(context context.Context, d *schema.ResourceD return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-resource_type").GetDiag() } if shareTarget.AccessProtocol != nil { - if err = d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil { - return diag.FromErr(fmt.Errorf("Error setting access_protocol: %s", err)) + if err := d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil { + err = fmt.Errorf("Error setting access_protocol: %s", err) + return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-access_protocol").GetDiag() } } if shareTarget.TransitEncryption != nil { diff --git a/website/docs/d/is_share.html.markdown b/website/docs/d/is_share.html.markdown index 95c4b0ed83..7948d5bf12 100644 --- a/website/docs/d/is_share.html.markdown +++ b/website/docs/d/is_share.html.markdown @@ -55,9 +55,6 @@ The following attributes are exported: - `href` - (String) The URL for this share accessor binding. - `id` - (String) The unique identifier for this share accessor binding. - `resource_type` - (String) The resource type. -- `allowed_transit_encryption_modes` - (List of string) The transit encryption modes allowed for this share. -- `allowed_access_protocols` - (List of string) Allowed access protocols for the share. -- `bandwidth` - (Integer) Bandwidth of the share - `access_tags` - (String) Access management tags associated to the share. - `created_at` - The date and time that the file share is created. - `crn` - The CRN for this share. From 02eddfa7dfaa73bd63e6410ab89e7496a09396dc Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Mon, 22 Sep 2025 10:19:40 +0530 Subject: [PATCH 13/13] transit encryption user_managed to ipsec in default handling and more checks --- ibm/service/vpc/resource_ibm_is_share.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index 355463f4bd..45d8ec3a59 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -1148,7 +1148,8 @@ func resourceIbmIsShareCreate(context context.Context, d *schema.ResourceData, m } if allowedTransitEncryptionModesIntf, ok := d.GetOk("allowed_transit_encryption_modes"); ok { allowedTransitEncryptionModes := []string{} - for _, allowedTransitEncryptionModesItemIntf := range allowedTransitEncryptionModesIntf.([]interface{}) { + allowedTransitEncryptionModesItems := allowedTransitEncryptionModesIntf.(*schema.Set) + for _, allowedTransitEncryptionModesItemIntf := range allowedTransitEncryptionModesItems.List() { allowedTransitEncryptionModesItem := allowedTransitEncryptionModesItemIntf.(string) if allowedTransitEncryptionModesItem == "user_managed" { allowedTransitEncryptionModesItem = "ipsec" @@ -1419,7 +1420,7 @@ func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, sh } } - if accessProtocolIntf, ok := shareTargetPrototypeMap["access_protocol"]; ok && accessProtocolIntf != nil { + if accessProtocolIntf, ok := shareTargetPrototypeMap["access_protocol"]; ok && accessProtocolIntf != nil && accessProtocolIntf.(string) != "" { accessProtocol := accessProtocolIntf.(string) shareTargetPrototype.AccessProtocol = &accessProtocol } else { @@ -1429,7 +1430,7 @@ func resourceIbmIsShareMapToShareMountTargetPrototype(d *schema.ResourceData, sh if transitEncryptionIntf, ok := shareTargetPrototypeMap["transit_encryption"]; ok && transitEncryptionIntf != "" { transitEncryption := transitEncryptionIntf.(string) if transitEncryption == "user_managed" { - transitEncryption = "none" + transitEncryption = "ipsec" } shareTargetPrototype.TransitEncryption = &transitEncryption } else { @@ -2153,15 +2154,18 @@ func shareUpdate(vpcClient *vpcv1.VpcV1, context context.Context, d *schema.Reso } if d.HasChange("allowed_transit_encryption_modes") { var allowedTransitEncryptionModes []string - for _, v := range d.Get("allowed_transit_encryption_modes").([]interface{}) { - allowedTransitEncryptionModesItem := v.(string) - if allowedTransitEncryptionModesItem == "user_managed" { - allowedTransitEncryptionModesItem = "ipsec" + if allowedTPMModesItemsIntf, ok := d.GetOk("allowed_transit_encryption_modes"); ok { + allowedTPMModesItems := allowedTPMModesItemsIntf.(*schema.Set) + for _, v := range allowedTPMModesItems.List() { + allowedTransitEncryptionModesItem := v.(string) + if allowedTransitEncryptionModesItem == "user_managed" { + allowedTransitEncryptionModesItem = "ipsec" + } + allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) } - allowedTransitEncryptionModes = append(allowedTransitEncryptionModes, allowedTransitEncryptionModesItem) + sharePatchModel.AllowedTransitEncryptionModes = allowedTransitEncryptionModes + hasChange = true } - sharePatchModel.AllowedTransitEncryptionModes = allowedTransitEncryptionModes - hasChange = true } if d.HasChange("access_control_protocols") { var access_control_protocols []string